Guide needed to learn Restful Web Service with PHP

Hi everyone,
I am about to learn Restful Web service.
I have been in LAMP environment quite a while, I’ve made several project with Php and Mysql.
I am comfortable with PHP development. Most of the time I make an app ‘traditionally’ without framework and without mvc pattern.

I’ve read some article about how a web app built with web service. and it comes to decision that my next project must implement Restful Web Service. I never work with Php framework before.

would it be good if start with pure core Php to build my Restful web service instead of build something with laravel, etc?
On top of that, what should I start with, to better understand and implement the Restful Web service ?

I don’t think it’s ever a wasted effort to learn something new, even if you never use it!

I used this for my PHP site (I’ve been using PHP since 2001, framework free): https://github.com/bradtraversy/slimapp
Now, instead of having to write several lines of code to connect to and retrieve data, it’s just one line call to the PHP API to get the JSON data :slight_smile:

I myself have been trying to sit down and learn Laravel for 2 years (been too busy learning and enjoying node/angular/react/etc. instead). I was wanting to write RESTful API’s with Laravel but yet to sit down and read the book I bought several months ago now.

Thanks @sipofwater ,
I read some Slim tutorial couple weeks ago, and still need sometime to get into the whole idea, generally on how API handle a request to database. I used to make a call to a database with a direct query inside the a php file which correspond directly with the page interface.

I will have a look on the github repo and I hope we can keep this conversation on this thread as I work on some slim tutorial :slight_smile:

Have a nice day!

hi @sipofwater,
I gave it a try and something went wrong,
when I put http://localhost/apitest/api/customers it throws a 404,
I realized I updated the slim to 3.x from the original conf file, the .htacess file seems okay, it has rewrite mode on.
does it contribute to my error? or something else?

Just fix the error, I found the correct url is http://localhost/firstapi/public/api/customers
but I wonder how can I access that without having that long url ? just like putting the endpoint, so I don;t need to put public/api/ on the url