Download the PHP package theplanworks/directus-laravel without Composer
On this page you can find all versions of the php package theplanworks/directus-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download theplanworks/directus-laravel
More information about theplanworks/directus-laravel
Files in theplanworks/directus-laravel
Package directus-laravel
Short Description A Package to integrate Laravel 5.4 and the Directus API
License MIT
Informations about the package directus-laravel
Directus API Wrapper for Laravel 5
This package allows users to easily consume the REST API provided by the Directus Headless CMS system in any Laravel app.
Installation
Install via composer using the command line:
In Laravel 5, update the config/app.php
providers array with the Service Provider:
Configuration
By default, the package is set up to use the following configuration values read from your .env
file:
DIRECTUS_CMS_URL
- The base URL of your CMS instance.DIRECTUS_API_KEY
- The key generated by the CMS and associated with a valid user that authenticates requests
If you would like to use a config file, you can publish the default config by running the following command:
This will publish a config file to config/directus-laravel.php
.
Usage
To utilize the API Wrapper, use dependency injection to resolve:
Then you can make the following calls:
getTableRows
Where $table
is the name of the Directus table you would like to access.
getTableRow
Where $table
is the name of the Directus table you would like to access, and $id
is the unique ID of the record being requested.
getTableRowBySlug
Where $table
is the name of the Directus table you would like to access, and $slug
is the unique slug property of the record being requested. PREREQUISITE: A slug
field must have been created on the table.
getFile
Where $url
is the file url you would like to return, such as /storage/uploads/00000000001.png
.
License
This package is open-sourced software licensed under the MIT license.