API Resources for PHP Developers
Created in 1995, PHP evolved from building simple CGI scripts to its own programming language to power dynamic backends. Many well known products such as Wordpress and Facebook were initially built in PHP. Even though PHP has shown it’s age, it’s hard to beet the sheer size of the PHP developer community. Moesif sees a lot of new APIs written with popular frameworks like Laravel even today.
There is a wide variance in quality of PHP code due to it’s use from amateur blogs to high traffic sites.
Background
-
PHP
-
LAMP Stack
The most popular tech stack in the early 2000s.
Tutorials for Creating RESTFul APIs
Like most web pages, you usually build APIs on tops of an existing framework. The most popular frameworks in PHP are Laravel and CodeIgniter.
-
Laravel
The most popular framework in the PHP ecosystem.
-
CodeIgniter
This framework is easier to get started than Laravel.
- RESTful Service in CodeIgniter
- Another short tutorial
- A Full RESTful Server implementation for CodeIgniter
- CodeIgniter Rap, a set of helpers that can be integrated with CodeIgniter.
- A video tutorial
Tutorials for Creating GraphQL APIs
GraphQL is promoted as an alternative to RESTful API, you can read more about the background on GraphQL, and other types of APIs here.
- Building a GraphQL server using Laravel
- GraphQL on Symfony framework
- Multi-part GraphQL on Laravel tutorial
Tutorials for Deployment
-
Heroku
-
AWS
-
Azure
-
Google App Engine
Useful Libaries
The most popular package manager for node is NPM.
-
Documentation
-
[Authenticationhttps://www.moesif.com/blog/technical/restful-apis/Authorization-on-RESTful-APIs/)
-
CORS
-
JSON
-
Utilities
- PHP httpclient
- retrofit-php, creating rest clients.
- hoa-project - A set of libraries for things like DNS, Protocols, Sessions, and more.
- monolog
-
Databases, Query Builder and ORMs
- Atlas.Orm
- Aura.Sql
- Aura.SqlQuery
- Cake ORM
- Doctrine Extensions - A collection of Doctrine behavioural extensions.
- Doctrine - A DBAL and ORM.
- Eloquent - A ORM
- LazyRecord - A ORM
- Pomm - An Object Model Manager for PostgreSQL.
- Propel - A fast ORM, migration library and query builder.
- ProxyManager - generates proxy objects for data mappers.
- RedBean - A configuration-less ORM.
- Spot2 - A MySQL datamapper ORM.
-
Testing
-
REST
- api-platform-core, Symfony framework
- Bullet PHP, a framework for creating APIs.
- API Platform - Hypermedia REST API that uses JSON-LD, Hydra format.
- Apigility - An API builder built on top of Zend Framework 2.
- Drest - Create REST resource APIs based on Doctrine entities.
- Hateoas - A HATEOAS REST web service library.
- Restler - A lightweight framework to expose PHP methods as RESTful web API.
-
GraphQL
-
WebSockets
- Ratchet - Ratchet is a loosely coupled PHP library providing developers with tools to create real time, bi-directional applications between clients and servers over WebSockets.
- Php-websocket - Simple PHP WebSocket implementation for PHP 5.3.
- Phpws - PHP Web Socket server.
- Sandstone - Microframework to build a real time Rest API.