Skip to content

Commit bc7cb60

Browse files
committed
Initial release 🎉
1 parent 2d586ca commit bc7cb60

File tree

9 files changed

+1122
-24
lines changed

9 files changed

+1122
-24
lines changed

‎.gitignore‎

Lines changed: 473 additions & 22 deletions
Large diffs are not rendered by default.

‎CHANGES.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
1.0.0 / 2020-10-20
2+
==================
3+
4+
* [added] Initial release 🎉

‎README.md‎

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,73 @@
1-
# directus-api-laravel
2-
API Wrapper for Laravel 5
1+
# Directus API Wrapper for Laravel 5
2+
3+
![packagist version](https://img.shields.io/packagist/v/c14r/directus-api-laravel)
4+
![directus version](https://img.shields.io/badge/directus-v8.8.1-blue)
5+
![laravel version](https://img.shields.io/badge/laravel-v5-blue)
6+
7+
This package allows users to easily consume the REST API provided by the Directus Headless CMS system in any Laravel app.
8+
9+
If your looking for an API Wrapper without using Laravel, see [c14r/directus-api](https://github.com/C14r/directus-api).
10+
11+
# Installing
12+
13+
The recommended way to install Directus-API is through
14+
[Composer](https://getcomposer.org/).
15+
16+
```bash
17+
composer require c14r/directus-api-laravel
18+
```
19+
20+
In Laravel 5, update the `config/app.php` providers array with the Service Provider:
21+
22+
```php
23+
C14r\Directus\Laravel\DirectusServiceProvider::class,
24+
```
25+
26+
# Configuration
27+
28+
By default, the package is set up to use the following configuration values from your `.env` file:
29+
30+
+ `DIRECTUS_URL` - The base URL of your Directus instance.
31+
+ `DIRECTUS_PROJECT` - The Directus project, you want to use
32+
33+
## Authentification
34+
35+
You can enter
36+
+ `DIRECTUS_API_KEY` - The key generated by Directus and associated with a user
37+
38+
or
39+
40+
+ `DIRECTUS_USERNAME` - The Directus username
41+
+ `DIRECTUS_PASSWORD` - The password for you Directus user
42+
43+
If you enter non of them, the guest access is used.
44+
45+
## Laravel
46+
47+
If you would like to use a config file, you can publish the default config by running the following command:
48+
49+
```bash
50+
php artisan vendor:publish --provider="C14r\Directus\Laravel\DirectusServiceProvider"
51+
```
52+
53+
This will publish a config file to `config/directus.php`.
54+
55+
# Usage
56+
57+
To utilize the API Wrapper, use dependency injection to resolve:
58+
59+
```php
60+
public function __construct(Directus $directus)
61+
{
62+
$this->api = $directus;
63+
}
64+
```
65+
66+
or use the helper function:
67+
68+
```php
69+
directus() // or directus('connection')
70+
```
71+
## How the API works
72+
73+
Take a look at [c14r/directus-api](https://github.com/C14r/directus-api) for more details.

‎composer.json‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "c14r/directus-api-laravel",
3+
"description": "API Wrapper for Laravel 5",
4+
"type": "library",
5+
"license": "GPL-3.0-only",
6+
"authors": [
7+
{
8+
"name": "Christian Pfeifer",
9+
"email": "mail@christian-pfeifer.de",
10+
"homepage": "http://www.christian-pfeifer.de/"
11+
}
12+
],
13+
"require": {
14+
"php": "^7.3",
15+
"c14r/directus-api": "^1.0.5"
16+
},
17+
"autoload": {
18+
"psr-4": {
19+
"C14r\\Directus\\Laravel\\": "src/"
20+
},
21+
"files": [
22+
"helpers.php"
23+
]
24+
}
25+
}

0 commit comments

Comments
 (0)