Nodes wrapper for Dingo API
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
resources/views
src
LICENSE
README.md
composer.json

README.md

API

A "mobile friendly" API package made on-top of the popular Dingo API package.

Total downloads Monthly downloads Latest release Open issues License Star repository on GitHub Watch repository on GitHub Fork repository on GitHub StyleCI

📝 Introduction

Before this package we used the awesome and popular Dingo API package, but as a company who create a lot of native iOS / Android apps, Dingo was lacking a few things here and there.

This package is in some way a more "mobile friendly" version of Dingo. It is build on-top of Dingo so all the goodies that Dingo comes with out-of-the-box is also available here.

We simply just added extra functionality and made it more flexible.

📦 Installation

To install this package you will need:

  • Laravel 5.1+
  • PHP 5.5.9+

You must then modify your composer.json file and run composer update to include the latest version of the package in your project.

"require": {
    "nodes/api": "^1.0"
}

Or you can run the composer require command from your terminal.

composer require nodes/api:^1.0

🔧 Setup

Setup service providers in config/app.php

Nodes\Api\ServiceProvider::class,

Setup alias in config/app.php

'API' => Nodes\Api\Support\Facades\API::class,
'APIRoute' => Nodes\Api\Support\Facades\Route::class

Publish config files

php artisan vendor:publish --provider="Nodes\Api\ServiceProvider"

If you want to overwrite any existing config files use the --force parameter

php artisan vendor:publish --provider="Nodes\Api\ServiceProvider" --force

Bypass Laravel's CSRF tokens

Laravel comes with a built-in CSRF token system, which is by default hooked into all POST requests. This gives us a bit of a problem since API requests won't contain the required CSRF token that Laravel expects. Therefore we need to whitelist all requests hitting our API.

This can be done by modifying the following file app/Http/Middleware/VerifyCsrfToken.php and add api/* to the $except array:

protected $except = [
    'api/*',
];

⚙ Usage

Please refer to our extensive Wiki documentation for more infromation

🏆 Credits

This package is developed and maintained by the PHP team at Nodes

Follow Nodes PHP on Twitter Tweet Nodes PHP

📄 License

This package is open-sourced software licensed under the MIT license