Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Gard Mikael Fjeldavli
Gard Mikael Fjeldavli
19,416 Points

Making PHP RESTful

So Im working on a project where I need to access and edit data in a database through a website. Accessing the database is written in PHP which works fine. But I have been asked to implement this in a RESTful way. The way I see it, REST is just a architectural style in which data is received and transferred. The resources I find online claims this should be an easy task, but I am struggling. Is there any tutorials which explains this (as basic as possible) or could anyone post some code on just how to GET lets say some values from a database on my localhost?

1 Answer

The Treehouse project called 'Enhancing a Simple PHP Application' might help - especially the 'Cleaning URLs with Subfolders/Rewrite Rules' sections. If you're using GET, your application is already somewhat RESTful, so maybe prettifying your urls so someone might be able to guess what they are is what they're after (the 'How to Build a WordPress Plugin' project also touches on this - Treehouse's api used in that project is a good example)