PHP code example of jmhc / laravel-api
1. Go to this page and download the library: Download jmhc/laravel-api library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jmhc / laravel-api example snippets
// 发布所有文件
php artisan vendor:publish --tag=jmhc-api
// 只发布配置文件
php artisan vendor:publish --tag=jmhc-api-config
// 只发布迁移文件
php artisan vendor:publish --tag=jmhc-api-migrations
// route
Route::get('tests', 'TestController@index');
// controller
use Jmhc\Restful\Controllers\BaseController;
use \Jmhc\Restful\Traits\ResourceControllerTrait;
class TestController extends BaseController
{
use ResourceControllerTrait;
}
// service
use \Jmhc\Restful\Services\BaseService;
class TestService extends BaseService
{
public function index()
{
$this->success('this is tests');
}
}