Skip to content

Instantly share code, notes, and snippets.

@bencorlett
Created December 30, 2013 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bencorlett/8180341 to your computer and use it in GitHub Desktop.
Save bencorlett/8180341 to your computer and use it in GitHub Desktop.
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