2017 © Pedro Peláez
 

library directus-laravel

A Package to integrate Laravel 5.4 and the Directus API

image

theplanworks/directus-laravel

A Package to integrate Laravel 5.4 and the Directus API

  • Thursday, March 2, 2017
  • by mixaster
  • Repository
  • 2 Watchers
  • 4 Stars
  • 68 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Latest Stable Version Total Downloads License , (*1)

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

Installation

Install via composer using the command line:, (*3)

composer require theplanworks/directus-laravel

In Laravel 5, update the config/app.php providers array with the Service Provider:, (*4)

thePLAN\DirectusLaravel\DirectusLaravelServiceProvider::class,

Configuration

By default, the package is set up to use the following configuration values read from your .env file:, (*5)

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

php artisan vendor:publish --provider="thePLAN\DirectusLaravel\DirectusLaravelServiceProvider"

This will publish a config file to config/directus-laravel.php., (*7)

Usage

To utilize the API Wrapper, use dependency injection to resolve:, (*8)

public function __construct(DirectusLaravel $directusAPI)
{
    $this->api = $directusAPI;
}

Then you can make the following calls:, (*9)

getTableRows

$value = $this->api->getTableRows($table);

Where $table is the name of the Directus table you would like to access., (*10)

getTableRow

$value = $this->api->getTableRow($table, $id);

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

getTableRowBySlug

$value = $this->api->getTableRowBySlug($table, $slug)

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

getFile

$this->api->getFile($url);

Where $url is the file url you would like to return, such as /storage/uploads/00000000001.png., (*13)

License

This package is open-sourced software licensed under the MIT license., (*14)

The Versions

02/03 2017

dev-master

9999999-dev

A Package to integrate Laravel 5.4 and the Directus API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Fox

02/03 2017

1.0.2

1.0.2.0

A Package to integrate Laravel 5.4 and the Directus API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Fox

28/02 2017

1.0.1

1.0.1.0

A Package to integrate Laravel 5.4 and the Directus API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Fox

28/02 2017

1.0.0

1.0.0.0

A Package to integrate Laravel 5.4 and the Directus API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Fox