2017 © Pedro PelĂĄez
 

library content-api

Allow to get translations via an Api and specific helper

image

famousinteractive/content-api

Allow to get translations via an Api and specific helper

  • Tuesday, December 5, 2017
  • by jeremy379
  • Repository
  • 2 Watchers
  • 0 Stars
  • 164 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 12 Versions
  • 5 % Grown

The README.md

contentApi

Set up a package to load translation from centralized api, (*1)

Basic Installation

  • composer require famousinteractive/content-api  
  • Add Famousinteractive\ContentApi\ContentApiServiceProvider::class in serviceProvider in config/app.php, (*2)

  • Publish the config file : php artisan vendor:publish, (*3)

  • Create the project on the translation platform, (*4)

  • Launch the command php artisan famousContentApi:initialize to generate the config file, (*5)

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), (*6)

    • $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), (*7)

    • $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.

The Versions

05/12 2017

dev-master

9999999-dev

Allow to get translations via an Api and specific helper

  Sources   Download

GPL-3.0+

The Requires

 

by Jérémy Dillenbourg

05/12 2017

v0.14

0.14.0.0

Allow to get translations via an Api and specific helper

  Sources   Download

GPL-3.0+

The Requires

 

by Jérémy Dillenbourg

05/12 2017

v0.13

0.13.0.0

Allow to get translations via an Api and specific helper

  Sources   Download

GPL-3.0+

The Requires

 

by Jérémy Dillenbourg

24/08 2017

v0.11

0.11.0.0

Allow to get translations via an Api and specific helper

  Sources   Download

GPL-3.0+

The Requires

 

by Jérémy Dillenbourg

18/08 2017

v0.10

0.10.0.0

Allow to get translations via an Api and specific helper

  Sources   Download

GPL-3.0+

The Requires

 

by Jérémy Dillenbourg

18/08 2017

v0.9

0.9.0.0

Allow to get translations via an Api and specific helper

  Sources   Download

GPL-3.0+

The Requires

 

by Jérémy Dillenbourg

26/06 2017

v0.8

0.8.0.0

Allow to get translations via an Api and specific helper

  Sources   Download

GPL-3.0+

The Requires

 

by Jérémy Dillenbourg

24/05 2017

v0.7

0.7.0.0

Allow to get translations via an Api and specific helper

  Sources   Download

GPL-3.0+

The Requires

 

by Jérémy Dillenbourg

23/05 2017

v0.6

0.6.0.0

Allow to get translations via an Api and specific helper

  Sources   Download

GPL-3.0+

The Requires

 

by Jérémy Dillenbourg

26/04 2017

v0.5

0.5.0.0

Allow to get translations via an Api and specific helper

  Sources   Download

GPL-3.0+

The Requires

 

by Jérémy Dillenbourg

25/04 2017

v0.4

0.4.0.0

Allow to get translations via an Api and specific helper

  Sources   Download

GPL-3.0+

The Requires

 

by Jérémy Dillenbourg

24/04 2017

v0.3

0.3.0.0

Allow to get translations via an Api and specific helper

  Sources   Download

GPL-3.0+

The Requires

 

by Jérémy Dillenbourg