Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

DMA's avatar
Level 2

Restful API Angular consumption series

Hi Jeffrey,

It'd be really good to see a series on how to implement Angular with a RESTFUL api created in Laravel.

You added a lesson touching on this around a year or so ago but it was quite trivial and you mentioned in that video that it wasn't necessarily the best way to implement the features.

Specifically, it'd be good to see how you'd handle the authentication process and permissions, handling failed posts to the API (you assumed posts would always pass in the previous video), and some other none trivial use cases.

0 likes
7 replies
davorminchorov's avatar

Great idea! +1

I am wondering when will the API series continue. I guess we gotta wait a little bit longer until Laravel 5 is released (it will probably be moved to L5) We got a lot of content coming our way so Jeffrey probably doesn't know where to start from! :D

AlexanderKim's avatar

Laravel + Angular would be interesting to see. Especially how to deal with search engines when you're using angular.

SP1966's avatar

99.9% of what is being requested here is AngularJS specific. An API, be it consumed by a client side JS app or any other app doesn't really change much if at all, especially if you use JSON Web Tokens rather than sessions and cookies.

AngularJS is every bit as popular in the client side JS community as Laravel is in the PHP community, probably more so. There are a great number of resources dedicated to teaching AngularJS, though admittedly, not always with Jeffrey's clarity of delivery!

Search Google and Youtube, you'll find a huge number of tutorials on AngularJS, many that include Laravel on the back end like this one: https://www.youtube.com/watch?v=18ifoT-Id54

http://ngmodules.org/ is a great source for ready made modules for AngularJS! Regarding security on the AngularJS side, take a close look at the HTTP-Auth-Interceptor module, when it receives a not authorized response it caches your recent requests, prompts the user to login, and upon success automatically reruns the previous requests! You can find a demo here: http://witoldsz.github.io/angular-http-auth/

Honestly, this is a oft requested tutorial here on Laracasts, and as much as I would love to see Jeffrey's take on it it is about as off topic as requesting a tutorial on building back end API's in Laravel on a AngularJS focused site.

1 like
DMA's avatar
Level 2

@SP1966, point taken - however my request was very specifically tailored towards the Laravel API aspect. For instance, it's not clear how Laravel can generate tokens for authentication, and how the filters for protecting routes would work when being accessed via an API.

It wouldn't matter too much whether the API was consumed by Angular, or even a mobile specific client (or whatever), what's interesting is how the API would be engineered and how its consumption would be handled.

Thank you for posting the links above, I'll take a look at them and see if some of my queries are dealt with. To clarify though, it's not really the Angular best practices that I'm looking for, it's the way that the Laravel code would be written that is of interest.

So, I feel my initial request remains valid.

SP1966's avatar

@DMA I guess this part of your original post confused me: "It'd be really good to see a series on how to implement Angular with a RESTFUL api created in Laravel." It sounded like you were requesting an AngularSJ tutorial.

Your last post is much clearer regarding your request and I agree, it would make for a great addition to the API tutorial. It would be of great interest to me to see how he would implement JWT based Auth, while also disabling Laravel's sessions.

DMA's avatar
Level 2

That's more so that we have a concrete real world example to help apply the logic to an actual scenario that we all, as developers may one day use.

@JeffreyWay any thoughts?

Please or to participate in this conversation.