It works out really well, I use angular front laravel back for all my projects these days (until I find time to learn django). Laravel does a lot of obnoxious things for you out of the box, like user auth, password reset, input sanitation, bcrypt pass hashing, ect. And it has a very nice SQL orm and route controller that makes designing rest APIs extremely easy.
Then using $resource I link angular to the rest api, and the project is live. I highly recommend it.
I've heard great thing about restangular, but I haven't run into a situation where in need it just yet, resource allows nested objects like /user/id/posts/id, which is most of my use cases.
Rest APIs are exceedingly simply in laravel. You have a routes file called routes.php. In that you define a route:
Route::resource ('user', 'UserController');
This sets up around 7 routes for you, read he doc for details on what they all are. They will be routed to the code in the UserController.
Then make the UserController. There is already a User model for you to use, but for any noun other then user, you'll have to make your own.
In the UserController, use the User model to implement the SQL calls.
I'm familiar with Laravel, just never made a REST API with it. I've done it in Rails, which functions in almost the same way as you describe. Thanks for the answer :).
How do you auth users? Do you use HTTP Headers, cookies, something else? Is it easy to deal with actual auth in the code?
3
u/8Bytes Oct 14 '14 edited Oct 14 '14
It works out really well, I use angular front laravel back for all my projects these days (until I find time to learn django). Laravel does a lot of obnoxious things for you out of the box, like user auth, password reset, input sanitation, bcrypt pass hashing, ect. And it has a very nice SQL orm and route controller that makes designing rest APIs extremely easy.
Then using $resource I link angular to the rest api, and the project is live. I highly recommend it.