-
-
Notifications
You must be signed in to change notification settings - Fork 315
Restler 3: Using it with Laravel's structure and Database
We will be using composer for gathering all the required source code and put them together.
You can learn about composer at https://getcomposer.org/doc/00-intro.md#globally follow the steps there to get composer installed globally.
I'm assuming the project name as api
use your own name of choice instead.
Once done you should be able to run composer on terminal from any folder. Now run the following
composer create-project laravel/database --prefer-dist api
Lets add restler
to this project
cd api
composer require restler/framework 3.0.0-RC6
you may want to look at the composer.json to understand how a specific version of a package can be requested
Ignore the suggestions, we surely don't need explorer from external package. It is part of restler now!
Folder structure will be familiar to you if you have used larvavel before.
-
Copy your api files in to
app/controllers
folder -
Look at the
public/index.php
and uncomment the lines related to restler -
Add your own api classes along with existing 'Explorer', and do all other customisations needed.
-
Make sure
app/store
and all the folders inside are writablechmod -R 0755 app/storage
-
Test the app using php built in server php artisan serve
Now you can point your browser to http://localhost:8000 to test your application. http://localhost:8000/explorer/ has the brand new explorer as well!
You can create your own database models and place them in app/models
or simply use DB::table('name')->where...
style queries. You can refer to laravel documentation for more info
All database related stuff that you used to do in artisan are now available for your project! we have added few more too! check them out and have fun!