Download the PHP package distilleries/contentful without Composer
On this page you can find all versions of the php package distilleries/contentful. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download distilleries/contentful
More information about distilleries/contentful
Files in distilleries/contentful
Package contentful
Short Description Package to use Contentful in offline mode.
License MIT
Informations about the package contentful
Distilleries / Laravel-Contentful-Utilities
Laravel-Contentful-Utilities is a Laravel 5.6 - 5.8 / Lumen package 5.6 - 5.8 package to use contentful in offline mode with and without preview. Contentful is a headless CMS in cloud you can have more information on their website https://www.contentful.com
Features
-
Model generator from contentful
-
Migration generator from contentful
- Synchronization from contentful to database
Installation
Composer
Install the [composer package] by running the following command:
composer require distilleries/contentful
Models and Mapper
When we synchronize all the data on database the mapper link to the model are call. This mapper car provide the extract of field you would like one the database. For example you want to externalize the title and the slug on the database you have to change the migration generated and the mapper.
All the model generated have a getters for all the payload fields. If you want to externalize the field on database.
Command-line tools
To make model and mapper from contentful
php artisan contentful:generate-models
:information_source: Models are generated on app_path('Models'); and the mappers are generated on app_path('Models/Mappers');
To make migration from contentful model
php artisan contentful:generate-migrations
To launch the synchronisation you can use this command line
-
php artisan contentful:sync-data {--preview}
php artisan contentful:sync-flatten {--preview}
:information_source: --preview is optional and use if you want to flatten the preview database.
Command | Explain |
---|---|
sync-data | Get all the entries from contentful and put in the flatten database |
sync-flatten | Get all the entries from data table to explode on all the other types |
Webhook
To flatten the preview or the regular database you need to set the webhook on Contentful
Create a controller and use the trait:
use \Distilleries\Contentful\Http\Controllers\WebhookTrait;
Make the route callable in post:
-
Live method is called to save on live mode
- Preview method is called to save the preview data
To display the site with preview database you have to use UsePreview middleware.
Add your middleware:
All versions of contentful with dependencies
ext-json Version *
contentful/contentful Version ^4.1
erusev/parsedown Version ^1.7
guzzlehttp/guzzle Version ^6.3
illuminate/support Version ~5.6|~5.7|~5.8|^6.0
illuminate/database Version ~5.6|~5.7|~5.8|^6.0
illuminate/cache Version ~5.6|~5.7|~5.8|^6.0
jenssegers/agent Version ^2.6