PHP Classes

How to Implement a PHP Async API using Sapphire: Build an API that handles request asynchronously

Recommend this page to a friend!
  Info   View files Example   View files View files (17)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2022-09-30 (1 month ago) RSS 2.0 feedNot yet rated by the usersTotal: 32 All time: 10,599 This week: 62Up
Version License PHP version Categories
sapphire 1.0GNU General Publi...5PHP 5, Web services, Language
Description Author

This package can build an API that handles requests asynchronously.

It uses ReactPHP to listen to HTTP connections of requests sent to an API defined by the API application.

The package can take a dispatcher object created by the application to define how each access to the API URLs this package will dispatch to classes that handle each supported API endpoint.

Picture of Pierre-Henry Soria
  Performance   Level  
Name: Pierre-Henry Soria <contact>
Classes: 39 packages by
Country: United Kingdom
Age: 31
All time rank: 41219 in United Kingdom
Week rank: 4 Up1 in United Kingdom Up
Innovation award
Innovation award
Nominee: 15x

Winner: 2x

Details

? Sapphire API ?

Sapphire is an amazing, precious, and great,... asynchronous RESTful API using ReactPHP and PHP 7.4.

The application is built on top of the Action-Domain-Responder (ADR) architecture.

? The Requirements

??? The Cooker

Pierre-Henry Soria. A versatile, programmatic and passionate software engineer who enjoys programming and developing new skills on a daily basis! ???

Reachable at hi {{AT}} ph7 [[D0T]] me!

? Set It Up

  1. Run `composer install` to install the project dependencies.
  2. Located in the project root, rename `.env.dist` to `.env` and edit the app details.
  3. Start the app server `php server.php`
  Files folder image Files  
File Role Description
Files folder imagesrc (1 file, 3 directories)
Accessible without login Plain text file .env.dist Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE.md Lic. License text
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file server.php Example Example script

  Files folder image Files  /  src  
File Role Description
Files folder imageCore (4 files)
Files folder imageException (2 files)
Files folder imageHttp (1 directory)
  Plain text file routes.php Class Class source

  Files folder image Files  /  src  /  Core  
File Role Description
  Plain text file ErrorHandler.php Class Class source
  Plain text file JsonRequestDecoder.php Class Class source
  Plain text file JsonResponse.php Class Class source
  Plain text file Router.php Class Class source

  Files folder image Files  /  src  /  Exception  
File Role Description
  Plain text file ProductNotFound.php Class Class source
  Plain text file UserAlreadyExists.php Class Class source

  Files folder image Files  /  src  /  Http  
File Role Description
Files folder imageAction (3 directories)

  Files folder image Files  /  src  /  Http  /  Action  
File Role Description
Files folder imageProduct (3 files)
Files folder imageUser (1 file)
Files folder imageUtility (1 file)

  Files folder image Files  /  src  /  Http  /  Action  /  Product  
File Role Description
  Plain text file GetItemDetails.php Class Class source
  Plain text file GetItems.php Class Class source
  Plain text file Input.php Class Class source

  Files folder image Files  /  src  /  Http  /  Action  /  User  
File Role Description
  Plain text file CreateUser.php Class Class source

  Files folder image Files  /  src  /  Http  /  Action  /  Utility  
File Role Description
  Plain text file StaticFiles.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:32
This week:0
All time:10,599
This week:62Up