asahasrabuddhe / laravel-api
A package that makes developing APIs in Laravel (Lumen too) very very easy
Requires (Dev)
- orchestra/testbench: ~3.6
- php-coveralls/php-coveralls: ^2.0
- dev-master
- 0.3.4-beta
- 0.3.3-beta
- 0.3.2-beta
- 0.3.1-beta
- 0.3-beta
- 0.2.1-beta
- 0.2.0-beta
- 0.1.1-beta
- 0.1-beta
- dev-dependabot/composer/guzzlehttp/psr7-1.9.1
- dev-dependabot/composer/symfony/http-foundation-4.4.49
- dev-dependabot/composer/guzzlehttp/guzzle-6.5.8
- dev-dependabot/composer/symfony/http-foundation-4.4.29
- dev-dependabot/composer/league/flysystem-1.1.4
- dev-dependabot/add-v2-config-file
- dev-dependabot/composer/php-coveralls/php-coveralls-2.4.3
- dev-dependabot/composer/orchestra/testbench-3.7.8
- dev-dependabot/composer/laravel/framework-5.6.40
- dev-dependabot/composer/erusev/parsedown-1.7.4
- dev-analysis-qBvJOL
- dev-analysis-zRyeWY
This package is auto-updated.
Last update: 2024-11-19 22:30:04 UTC
README
A powerful package designed to make developing APIs very easy. This package takes care of all the boiler-plate code to provide support for routes, controller methods and associated logic out of the box.
Please note, this package is still in development and the documentation below is subject to change in ways which can make it incompatible with previous versions. Please DO NOT use in production until 1.0 release.
Installation
The package is currently under development and hence is not available on composer. Please use the following method to install and help build this package.
Clone the repository inside your Laravel installation as follows:
git clone https://github.com/asahasrabuddhe/laravel-api packages/asahasrabuddhe/laravelapi
Add the following lines in your composer.json file to help install the package
"repositories": [
{
"type": "path",
"url": "packages/asahasrabuddhe/laravel-api",
"options": {
"symlink": true
}
}
],
Then, add the following lines in the require section of your composer file and run composer update.
"asahasrabuddhe/laravel-api": "dev-master"
You are now ready to use the package.
Basic Usage
- To enable using this package, replace the following:
a. Models: Replace all instances of
use Illuminate\Database\Eloquent\Model;
withuse Asahasrabuddhe\LaravelAPI\BaseModel;
. For the Laravel default user model, replaceuse Illuminate\Foundation\Auth\User as Authenticatable;
withuse Asahasrabuddhe\LaravelAPI\BaseUser as Authenticatable;
b. Controllers: Add the following line to the top of your controller:
use Asahasrabuddhe\LaravelAPI\BaseController as Controller
2.Routing: Please define the routes as following in routes/api.php file:
ApiRoute::group([
'middleware' => ['api'],
'namespace' => 'App\Http\Controllers'], function () {
ApiRoute::resource('user', 'UserController');
ApiRoute::resource(<route>, <controller>);
}
);