Skip to content

Lightweight REST API framework for beginners, implemented in PHP.

License

Notifications You must be signed in to change notification settings

NewtonAcademy/FrankJunior

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FrankJunior README

What is FrankJunior?

FrankJunior is a lightweight framework implemented in PHP that enables you to quickly and easily deploy a database-backed RESTful API.

Who wrote it?

FrankJunior is written by Binyamin Bauman of Newton Academy. It is a stripped-down, modified, and enhanced version of Frank, which in turn is a clone of Sinatra.

Why was FrankJunior written?

FrankJunior is primarily a learning tool for developers in training. As such, non-essential functionality has been removed, and the remaining code has been heavily commented and refactored with an eye toward simplicity.

How do I install FrankJunior?

  1. Copy all of FrankJunior's files into a directory somewhere within your Apache-driven website's DocumentRoot. For the purposes of this README, we're going to assume your website is www.example.com, and that you've copied FrankJunior's files into /api.
  2. Create and save your database connection file outside the website's root, as per the template provided in a comment inside index.php. If you don't have an existing database to use with FrankJunior, create a new one; just make sure the database name matches whatever is specified in the connection file.
  3. Make sure that Apache is configured to AllowOverride for the /api directory, so that the settings in the .htaccess file can take effect.
  4. Test your installation by visiting http://www.example.com/api in a browser. You should see a message that says "Welcome to FrankJunior!".
  5. Visit http://www.example.com/api/colors, which is the address of the example API included with FrankJunior. The first time you do so, the database table that this API utilizes will be automatically created.

How does FrankJunior work?

Once you've installed FrankJunior, check out the usage examples in the included index.php file. Simply put, you register "routes" with FrankJunior. A route is a request path to match, for example /whut/else. You also register a callback function for each route, for example function(){ echo 'Some output.'; }. When a request is made to FrankJunior, it finds the route that matches the request and invokes its callback function. Following our example, when the user loads http://www.example.com/api/whut/else, they'll see a page that says "Some output."

What are some of FrankJunior's features?

The routes that you register can include named parameters, wildcards, and regular expressions, which makes FrankJunior really powerful and cool.

About

Lightweight REST API framework for beginners, implemented in PHP.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages