API server in PHP with Oauth2

Hi all

Does anyone have a good tutorial to create an API server in PHP with Oauth2?
I found one on Sitepoint, but I think it’s a little dated, as it uses Oauth1.

Thanks in advance

Why reinvent the wheel? :smile: https://github.com/thephpleague/oauth2-server


Thanks Scott.
I looking more for a tutorial, so I can learn step by step.


Take a look at -

Thanks for your reply Kelvin.
It is appreciated.
I’ve read through this tutorial.
It’s interesting, but I’m looking for an Oauth2 tutorial, not Oauth1.

Have an awesome day :smile:

I would say, most of the time, people don’t make tutorials on how to build specific things. Because, what is the usefulness of that tutorial to the students, when that something is already built through the tutorial?

Have you heard of the saying, “Give a man a fish, and he can eat for a day. Teach a man to fish, and he can eat for a lifetime”?

In other words, you can find either tutorials on Oauth or tutorials on APIs in PHP. Through them you’ll learn those concepts. But, you’ll be hard pressed to find tutorials on specifically on building an Oauth2 API server with PHP, without a whole lot of the work already done for you.

For example, the Oauth article linked above uses Oath-php as a library. So, you could theoretically use that tutorial as sort of a basis (teaches how to fish), but use the library I had linked to and try out your luck for a more modern Oauth server.

The docs of the library I linked to is also not too shabby either.

Check this out too. https://bshaffer.github.io/oauth2-server-php-docs/cookbook/


Thanks for the info.
I’m going to check it out.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.