PHP REST API Frameworks

What is the best PHP RESTful API Framework for my project?

A number of articles on websites strive to give directions which RESTful API frameworks should be chosen whereas in fact there is no “one fits all” solutions that suit different purposes or technologies. Another question is whether to go for Model-View-Controller (MVC) or Resource-Method-Representation (RMR) model.
Therefore, herewith a compiled list of some most popular and actively developed PHP REST API frameworks worth consideration and further evaluation on your project basis:

Epiphany

The Epiphany framework is fast, easy, clean and RESTful. The framework does not do a lot of magic under the hood. It is, by design, very simple and very powerful.

The documentation provides a few conventions that we believe lead to well written code but you’re free to use any style you’d like. The framework never dictates how you should write or structure your application.

https://github.com/jmathai/epiphany

Fat Free

A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust web applications – fast!

  • Super lightweight code base with just ~55kb
  • Full-featured toolkit
  • Easy to learn, use and extend
  • Fast and clean template engine
  • Unit testing toolkit
  • Database-managed sessions
  • Markdown-to-HTML converter
  • Atom/RSS feed reader
  • Image processor
  • Geodata handler
  • On-the-fly Javascript/CSS compressor
  • OpenID (consumer)
  • Custom logger
  • Basket/Shopping cart
  • Pingback server/consumer
  • Unicode-aware string functions
  • SMTP over SSL/TLS
  • Tools for communicating with other servers
  • Data Validation
  • and more Plugins from the F3-Community

http://fatfreeframework.com

Flight

Flight is a fast, simple, extensible framework for PHP. Flight enables you to quickly and easily build RESTful web applications.

http://flightphp.com

Frapi

Frapi is a  high-level PHP REST API framework that powers web apps, mobiles services and legacy systems, enabling a focus on business logic and not the presentation layer.
FRAPI handles multiple media types, response codes and generating API documentation. It was originally built by echolibre to support the needs of their client’s web apps, and now it’s been open-sourced.

http://getfrapi.com/

Guzzle

Guzzle takes the pain out of sending HTTP requests and the redundancy out of creating web service clients. It’s a framework that includes the tools needed to create a robust web service client, including: Service descriptions for defining the inputs and outputs of an API, resource iterators for traversing paginated resources, batching for sending a large number of requests as efficiently as possible.

  • All the power of cURL with a simple interface.
  • Persistent connections and parallel requests.
  • Streams request and response bodies.
  • Service descriptions for quickly building clients.
  • Powered by the Symfony2 EventDispatcher.
  • Use all of the code or only specific components.
  • Plugins for caching, logging, OAuth, mocks, and more.
  • Includes a custom node.js webserver to test your clients.

http://guzzlephp.org

Kohana

An elegant HMVC PHP5 framework that provides a rich set of components for building web applications.

  • Many common components are included: translation tools, database access, code profiling, encryption, validation, and more.
  • Use specific libraries and tools: extending existing components and adding new libraries is very easy.
  • Write commercial applications: uses the BSD license, so you can use and modify it for commercial purposes.
  • A very fast framework: benchmarking a framework is hard and rarely reflects the real world, but Kohana is very efficient and carefully optimized for real world usage.
  • Good debugging and profiling tools: simple and effective tools help identify and solve performance issues quickly.
  • Know what the framework is doing: very well commented code and a simple routing structure makes it easy to understand what is happening.
  • Work with objects and classes: an OOP framework that is extremely DRY. Everything is built using strict PHP 5 classes and objects.
  • Write your own code: there are no code generators and endless configuration files, so setting up is fast and easy.
  • Community support: a very active community forum and IRC channel means that most questions are answered very quickly.

http://kohanaframework.org

Laravel

Laravel is a clean and classy framework for PHP web development. Freeing you from spaghetti code, Laravel helps you create wonderful applications using simple, expressive syntax. Development should be a creative experience that you enjoy, not something that is painful. A well written documentation is a big plus.

Advantages over other frameworks:

  • Bundles
  • The Eloquent ORM
  • Application Logic
  • Reverse Routing
  • Restful Controllers
  • Class Auto Loading
  • View Composer
  • The Inversion of Control (IoC) container
  • Migrations
  • Unit-Testing
  • Automatic Pagination

http://laravel.com

Phalcon

Phalcon is an open source, full stack framework for PHP 5 written as a C-extension, optimized for high performance. You don’t need to learn or use the C language, since the functionality is exposed as PHP classes ready for you to use. Phalcon also is loosely coupled, allowing you to use its objects as glue components based on the needs of your application.

Phalcon is not only about performance, our goal is to make it robust, rich in features and easy to use!

Full MVC applications

  • Single-Module
  • Multi-Module
  • Micro Applications
  • ORM
    • Transactions
    • Behaviors
    • Relations
    • PHQL
    • Events
    • Validations
    • Hydration
    • Logging
    • Profiling
    • Sharding
  • ODM for Mongo
  • Template Engine (Volt)
  • DI/IOC
  • Events Management
  • Encryption
  • HTTP Request / Response / Cookies
  • Escaping / Filtering
  • Forms Builder / Validation
  • Flash Messages
  • Cache
  • Pagination
  • Annotations
  • Security
  • Translations
  • Assets Management
  • Universal Auto-Loader
  • Logging
  • CLI

http://phalconphp.com/

Recess

You should enjoy PHP development. That’s why Recess exists. Recess is a RESTful PHP framework designed to give you a delightful development experience.

  • Tools included for every developer
  • Declarative PHP with annotations
  • Stays out of your way, not in it
  • Loosely coupled Model-View-Controller
  • Create RESTful APIs with Ease
  • D.R.Y. in philosophy & practice
  • Caching-oriented architecture
  • Open source under MIT license

http://www.recessframework.org

Restler

A RESTful API server framework that is written in PHP that aids your mobile / web / desktop applications. A framework, but with a difference – Restler is all here to bend and mend to your needs. Turn your classes and its methods into an easily usable and better Web citizen with Restler.

  • Writing Server is made easy and light with just 3 PHP files
  • Simplicity through writing object oriented PHP like
  • Public methods are automatically mapped to a URL
  • Customization options and plugin architecture
  • Supporting for different formats like json, xml, yaml, amf, plist and custom formats
  • Support for different authentication schemes allowing to add your own auth plugins

http://luracast.com/products/restler

Slim

Slim is a lightweight PHP micro framework for simple yet powerful web applications and APIs.

  • Powerful router
    • Standard and custom HTTP methods
    • Route parameters with wildcards and conditions
    • Route redirect, halt, and pass
    • Route middleware
  • Template rendering with custom views
  • Flash messages
  • Secure cookies with AES-256 encryption
  • HTTP caching
  • Logging with custom log writers
  • Error handling and debugging
  • Middleware and hook architecture
  • Simple configuration

http://www.slimframework.com

Symfony2: FOSRestBundle

This bundle provides various tools to rapidly develop RESTful API’s & applications with Symfony2. Features include:

  • A View layer to enable output and format agnostic Controllers
  • A custom route loader to generate url’s following REST conventions
  • Accept header format negotiation including handling for custom mime types
  • RESTful decoding of HTTP request body and Accept headers
  • Exception controller for sending appropriate HTTP status codes

https://github.com/FriendsOfSymfony/FOSRestBundle

Symfony2: Silex

Silex is a PHP microframework for PHP 5.3. It is built on the shoulders of Symfony2 and Pimple and also inspired by sinatra.

A microframework provides the guts for building simple single-file apps. Silex aims to be:

  • Concise: Silex exposes an intuitive and concise API that is fun to use.
  • Extensible: Silex has an extension system based around the Pimple micro service-container that makes it even easier to tie in third party libraries.
  • Testable: Silex uses Symfony2’s HttpKernel which abstracts request and response making it very easy to test apps & the framework itself.
  • Respects the HTTP specification and encourages its proper use.

http://silex.sensiolabs.org

Tonic

A resource focused PHP RESTful API library where everything useful is a resource located by URLs.

  • URI annotations
  • Content negotiation
  • Method conditions
  • Mount points

http://peej.github.io/tonic

Wave Framework

A compact PHP micro-framework built loosely on model-view-control (MVC) architecture and factory method design pattern. It is made for web services, websites, info-systems and is built around a native API architecture, caching and smart image and resource management. Wave is a framework that does not include optional libraries with a very small footprint, lightweight and speed in mind.

Wave comes by default with a view controller and a gateway intended for website functionality with clean URLs that also incorporates a front-end JavaScript controller.

  • Modern API-centric framework for PHP versions 5.3 and above
  • Secure API requests with hash validation, token and key-based authentication
  • Dynamically loaded Hierarchical MVC objects through Factory pattern
  • API returns XML, CSV, JSON, HTML, native PHP and other data formats
  • Compressed data output with Deflate and Gzip
  • Input and output data is fully UTF-8
  • PDO-specific database controller for general-use database connections
  • Index gateway and Handlers for all types of HTTP requests
  • Caching system with tagging support for all types of dynamic and static requests
  • View and URL Controllers that support multiple languages and clean URL’s
  • Users and permissions control
  • jQuery JavaScript framework supported
  • On-demand dynamic image resizer and editor
  • On-demand resource compression, unifying and minifying
  • Automatic sitemap.xml and robots.txt generation
  • Automatically generated API documentation
  • API wrapper classes that make browser and server to server communication easy
  • 256bit Rijndael encrypted data transmission
  • API Observers for creating event-specific listeners
  • Installation-specific MVC class and resource overrides
  • Custom on-demand session handling
  • Request limiter that can block HTTP requests under certain conditions
  • Request logger that can be used for detailed performance grading of HTTP requests
  • Debugging, backup, update and filesystem maintenance tools
  • Compatibility script that tests support for server setup
  • Supports Apache and Nginx servers in Linux and Windows environments
  • Test Suite for API Testing
  • Filesystem caching, database cache, APC and Memcache supported
  • 100+ pages of detailed documentation and tutorials
  • Licensed under GNU Lesser General Public License Version 3

http://www.waveframework.com

Yii

Yii is a high-performance PHP framework best for developing Web 2.0 applications. It comes with rich features: MVC, DAO/ActiveRecord, I18N/L10N, caching, authentication and role-based access control, scaffolding, testing, etc. It can reduce your development time significantly.

http://www.yiiframework.com/

Zend: Zend_Rest_Server

Zend Framework 2 is an open source framework for developing web applications and services using PHP 5.3+. Zend Framework 2 uses 100% object-oriented code and utilises most of the new features of PHP 5.3, namely namespaces, late static binding, lambda functions and closures…

http://framework.zend.com

Other PHP REST API Frameworks

If you wish to add a missing and actively developed framework or make any suggestions on how to improve this page please feel free to leave a comment.

29 thoughts on “PHP REST API Frameworks

    • Hi Xanza, Which Flight API? There are quite few out there hence a URL would be much appreciated.

      I’d be happy to include new frameworks as long as they are not paid products, community based and actively maintained.

  1. Pingback: PHP Rest Api Framework - Which to choose? | BlogoSfera

  2. Thank you david for this helpful article, I think also that another article in the form of pros and cons for every framework will be very helpful too.

    Thanks a lot and Best Regards.

  3. I’m a front end dev with an app idea and I’d love a PHP REST framework that is easy to use out of the box. I’m not looking to modify it much–or even at all, if possible. Any particular recommendations from the list above?

    • Hi, it really depends on your project requirements and personal preferences. I tend to use Laravel for mid-weight projects and its nice documentation (there are some glitches in it but can always count on community help).

    • Hi Joel, I’ve had a look at your REST API – it’s super simple! Unfortunately, am unable to include in the list at this point as there is no active community nor proved support around it. Though, hope by approving your comment will contribute somehow in driving more people towards further development and hopefully it’ll then get on the list. Many thanks for the link submission and keep up the good work!

  4. Is there any reason why you have not listed Apify. Could you also write about the framework which you would prefer the most for a Enterprise REST api solution.

  5. I’m going to built an web app that process image and stores it to server and DB. I would like to ask what PHP framework is good to use? Knowing that I will implement it using REST. Thanks,

    • I’d start off by clearly defining project goals and write down application functionalities such as login, files upload etc. you’d like your framework to handle. Then check for available plugins / packages that could be reused/customised to cover those functionalities. Once you’ve narrowed down look at documentation and support. As last thing I’d give a try to one or more frameworks to see which one feels better for you to use – pretty much all of them will do the job you mention.

      When you say ‘image and stores it to server and DB’ do you mean storing images in DB using blob or data only and images on server’s hard drives/storage device?

      • Hi David,

        Thanks for the advice. Basically right now I will have only login, image upload, resize image into 2 sizes, retrieve image from the server, and user registration. Can you suggest any framework base on my functionalities?

        I mean on storing is I will store data only on the DB. Ex. file/path/to/img/img_name, then images on the server.

        • Image resize normally would not belong to a back-end REST framework and rather front-end such as jQuery or any other libraries capable of handling such functionality (searching on google should give some decent results).

          Laravel has a built in very basic login/authentication or alternatively you could reuse https://github.com/andrew13/Laravel-4-Bootstrap-Starter-Site and modify to your needs. Yii would probably be my second choice but have a go at both to see which one you like more.

  6. Hi David.

    I really like your post!!
    I want to start with a framework able to do almost everything (autentication, restfull services etc..). I want to be good in a specific framework.

    I would like to ask what PHP framework is good to use?

    (sorry for my english i am a capverdean).

    • I would give a try a couple of major frameworks like Laravel, Phalcon, Symphony, Restler, Slim or Yii and see which one you like most / fit your project requirements best. They all have their strengths and weaknesses in different areas.

Leave a Reply

Your email address will not be published. Required fields are marked *


5 × one =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">