Created
December 30, 2013 10:26
-
-
Save bencorlett/8180341 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To use `2.0.*@dev` version of API... Do the following: | |
1. Remove old API service providers and just add `Cartalyst\Api\Laravel\ApiServiceProvider` instead. | |
2. Remove all old API facades (there was overrides for Input, Request etc) and use the following 2 facades: | |
'API' => 'Cartalyst\Api\Laravel\Facades\API', | |
'ApiResponse' => 'Cartalyst\Api\Response', | |
3. Add the following to `app/start.php`, around line 14 (before `$app = new Illuminate\Foundation\Application`: | |
require_once __DIR__.'/../vendor/cartalyst/api/src/start.php'; | |
4. Add something like this to your `app/routes.php` file: | |
``` | |
Route::get('/', function() use ($app) | |
{ | |
var_dump(API::get('foo?bar=baz')); | |
var_dump(API::post('bar', ['baz' => 'qux', 'fred' => new stdClass])); | |
}); | |
Route::get('foo', function() | |
{ | |
return new ApiResponse(['bar' => 'baz', 'qux' => new stdClass]); | |
}); | |
Route::post('bar', function() | |
{ | |
var_dump(Input::json()); | |
}); | |
``` | |
Give feedback! :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment