famousinteractive/content-api 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

famousinteractive/content-api

Composer 安装命令:

composer require famousinteractive/content-api

包简介

Allow to get translations via an Api and specific helper

README 文档

README

Set up a package to load translation from centralized api

Basic Installation

  • composer require famousinteractive/content-api  

  • Add Famousinteractive\ContentApi\ContentApiServiceProvider::class in serviceProvider in config/app.php

  • Publish the config file : php artisan vendor:publish

  • Create the project on the translation platform

  • Launch the command php artisan famousContentApi:initialize to generate the config file

Usage

  • use fitrans($key, $params = [], $lang = null, $default = '') to use the translation via the Content Api.

Dataset

  • To get the data of a dataset, use the function fitds($datasetName, $prefixLang = false, $param=[], $useCache=true)

    • $datasetName is the unique name of the dataset
    • $prefixLang Boolean allowing you to use a different dataset for each language.
    • $param string with the data to return. Values :
      • "fields" Just the list and the type of the fields.
      • "datas" All entries in the dataset with information on the fields.
      • "formatted" An array with the association with Field => value and no more data.
      • "All" All these data in once. By default
    • $useCache Boolean. True by default. If you get data who change often (like dataset to store user data for example), you may prefer to not cache the result.
  • To put new record in a dataset, use the function fitpushds($datasetName, $data=[], $prefixLang = false)

    • $datasetName and $prefixLang have the same behavior as for fitds() function
    • $data is an array with an association of field name and value.
      • [ 'lastname' => 'Dillenbourg', 'firstname' => 'Jérémy', 'birtdate' => '1990-07-03' ]
    • The return is either true or an array ['success' => false, 'message' => 'error_description'] . The fields are validated by the rules set in the platform. If the validation fails, you'll receive an error response.

Extra

  • You can call /fit-content-api-clear-cache?clientId=xxxxxx in order to clear the cache of the website
  • You can run php artisan famousContentApi:collect to collect all the fitrans() reference and send them to the platform.
  • You can force to render all the translation key by adding paremeters to the url of your website
    • ?fitrans=display_keys&exclusion=routes
    • fitrans=display_keys render all the keys, fitrans=edit_keys generate html tags handled by the chrome extension
    • exlusion exlude some pattern. Here all keys starting by routes.. It's usefull if you use fitrans() in the route file.

统计信息

  • 总下载量: 372
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2017-04-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固