在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):teepluss/laravel4-api开源软件地址(OpenSource Url):https://github.com/teepluss/laravel4-api开源编程语言(OpenSource Language):PHP 100.0%开源软件介绍(OpenSource Introduction):Laravel HMVC.
API is a tool for making internal request (HMVC). InstallationTo get the lastest version of Theme simply require it in your
You'll then need to run Once Theme is installed you need to register the service provider with the application. Open up
API also ships with a facade which provides the static syntax for creating collections. You can register the facade in the
Publish config using artisan CLI.
UsageAPI helping you to work with internal request. Internal testing request.// GET Request.
API::get('user/1');
// POST Request.
API::post('user', array('title' => 'Demo'));
// PUT Request.
API::put('user/1', array('title' => 'Changed'));
// DELETE Request.
API::delete('user/1');
// Internal request with domain route.
API::invoke('http://api.domain.com', 'post', array('param' => 1))
// You can make remote request without changing code also.
API::post('http://api.github.com', array('username' => 'teepluss'));
// Request remote with invokeRemote.
API::invokeRemote('http://api.github.com', 'post', array('username' => 'teepluss'));
// Get Guzzle to use other features.
$guzzle = API::getRemoteClient();
Calling via artisan CLI.// Internal GET.
$ php artisan api:call --request GET /some/route?param=value
// Internal POST.
$ php artisan api:call --request POST /some/form --data "name=Tee"
// Remote request.
$ php artisan api:call --request GET http://google.com
Create reponses format for RESTful.// Response entries.
$users = User::all();
API::createResponse($users);
// Response entry.
$user = User::find($id);
return API::createResponse($user);
// Response Laravel error.
$errors = $validation->messages()->all(':message');
return API::createResponse(compact('errors'), 400);
// Response created data.
$user = Url::create($data);
return API::createResponse($user, 201);
// Response 404.
API::createResponse("User [$id] was not found.", 404);
//Response deleted.
API::createResponse(null, 204);
Changesv1.0.1
v1.0.0
Support or ContactIf you have some problem, Contact [email protected] |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论