Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
64% | Total: 261 | All time: 7,801 This week: 524 |
Version | License | PHP version | Categories | |||
reactphp-pimf 1.0.21 | Freeware | 5 | HTTP, PHP 5, Web services |
Collaborate with this project | Author | |
reactphp-pimf - github.com Description This package can implement an asynchronous RESTful API using ReactPHP and PIMF. Innovation Award |
This is an reactive RESTful API which uses ReactPHP and PIMF micro framework.
ReactPHP is one of the most promising libraries. It brings the powerful concept of event-driven, non-blocking I/O (Hi NodeJS) to PHP. With this technology in mind we are able to write our own HTTP stack in PHP and have control back over the memory without destroying it at the end of each request.
ReactPHP is responsible for establishing the TCP-Socket, transferring the raw HTTP Requests and sending the HTTP Responses back.
PIMF micro framework is responsible for managing the HTTP Resources using the HTTP request methods, validation and handling the persistence interactions.
[vagrant@gkrsteski php-reactor]$ loadtest http://10.0.49.227:5501/articles/10 -t 20 -c 20 --rps 1000
[Wed Feb 10 2016 12:24:47 GMT+0100 (CET)] INFO Requests: 0, requests per second: 0, mean latency: 0 ms
[Wed Feb 10 2016 12:24:52 GMT+0100 (CET)] INFO Requests: 4516, requests per second: 903, mean latency: 10 ms
[Wed Feb 10 2016 12:24:57 GMT+0100 (CET)] INFO Requests: 9515, requests per second: 1000, mean latency: 0 ms
[Wed Feb 10 2016 12:25:02 GMT+0100 (CET)] INFO Requests: 14515, requests per second: 1000, mean latency: 10 ms
[Wed Feb 10 2016 12:25:07 GMT+0100 (CET)] INFO
[Wed Feb 10 2016 12:25:07 GMT+0100 (CET)] INFO Target URL: http://10.0.49.227:5501/articles/10
[Wed Feb 10 2016 12:25:07 GMT+0100 (CET)] INFO Max time (s): 20
[Wed Feb 10 2016 12:25:07 GMT+0100 (CET)] INFO Concurrency level: 20
[Wed Feb 10 2016 12:25:07 GMT+0100 (CET)] INFO Agent: none
[Wed Feb 10 2016 12:25:07 GMT+0100 (CET)] INFO Requests per second: 1000
[Wed Feb 10 2016 12:25:07 GMT+0100 (CET)] INFO
[Wed Feb 10 2016 12:25:07 GMT+0100 (CET)] INFO Completed requests: 19512
[Wed Feb 10 2016 12:25:07 GMT+0100 (CET)] INFO Total errors: 0
[Wed Feb 10 2016 12:25:07 GMT+0100 (CET)] INFO Total time: 20.000516531000002 s
[Wed Feb 10 2016 12:25:07 GMT+0100 (CET)] INFO Requests per second: 976
[Wed Feb 10 2016 12:25:07 GMT+0100 (CET)] INFO Total time: 20.000516531000002 s
[Wed Feb 10 2016 12:25:07 GMT+0100 (CET)] INFO
[Wed Feb 10 2016 12:25:07 GMT+0100 (CET)] INFO Percentage of the requests served within a certain time
[Wed Feb 10 2016 12:25:07 GMT+0100 (CET)] INFO 50% 2 ms
[Wed Feb 10 2016 12:25:07 GMT+0100 (CET)] INFO 90% 9 ms
[Wed Feb 10 2016 12:25:07 GMT+0100 (CET)] INFO 95% 18 ms
[Wed Feb 10 2016 12:25:07 GMT+0100 (CET)] INFO 99% 30 ms
[Wed Feb 10 2016 12:25:07 GMT+0100 (CET)] INFO 100% 36 ms (longest request)
php run-server.php
Build a Docker image for your application by running:
docker build -t="reactphp-pimf-api" .
Finally, run your application as a Docker container by running:
docker run -d -p 1337:1337 reactphp-pimf-api
HTTP Verb | Entire Collection (e.g. /articles) | Specific Item (e.g. /articles/{id})
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
GET | 400 (Bad Request) | 200 (OK), single article.
| | 404 (Not Found), if ID not found or 400 (Bad Request) if invalid.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
PUT | 405 (Method Not Allowed) | 200 (OK),
| - unless you want to update/replace every resource in the entire collection. | 404 (Not Found) if ID not found or 400 (Bad Request) if invalid.
| - 'Location' header with link to API documentation |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
POST | 201 (Created), | 405 (Method Not Allowed)
| - 'Location' header with link to /articles/{id} containing new ID. | - 'Location' header with link to API documentation
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
DELETE | 404 (Not Found) or 405 (Method NOt Allowed) | 200 (OK)
| - unless you want to delete the whole collection?not often desirable. | 404 (Not Found) if ID not found or 400 (Bad Request) if ID invalid.
| - 'Location' header with link to API documentation |
Install a Composer to your project's root
php composer.phar require "codeception/codeception:*"
// or ...
composer require "codeception/codeception:*"
Execute tests
php vendor/codeception/codeception/codecept run --colors
// or if want to see steps ...
php vendor/codeception/codeception/codecept run --steps
// or if want to see fancy HTML report page
php vendor/codeception/codeception/codecept run --html
Files (70) |
File | Role | Description | ||
---|---|---|---|---|
.github (2 directories) | ||||
app (3 files, 1 directory) | ||||
tests (2 files, 3 directories) | ||||
.codeclimate.yml | Data | Auxiliary data | ||
.dockerignore | Data | Auxiliary data | ||
.editorconfig | Data | Auxiliary data | ||
.gitattributes | Data | Auxiliary data | ||
.gitignore | Data | Auxiliary data | ||
.travis.yml | Data | Auxiliary data | ||
build.sh | Data | Auxiliary data | ||
codeception.yml | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
create-table.php | Example | Example script | ||
Dockerfile | Data | Auxiliary data | ||
init-app.sh | Data | Auxiliary data | ||
local-pipeline.sh | Data | Auxiliary data | ||
README.md | Doc. | Documentation | ||
run-server.php | Example | Example script | ||
SECURITY.md | Data | Auxiliary data | ||
sweep.sh | Data | Auxiliary data | ||
test.sh | Data | Auxiliary data | ||
_config.yml | Data | Auxiliary data |
Files (70) | / | app |
File | Role | Description | ||
---|---|---|---|---|
Articles (5 directories) | ||||
autoload.app.php | Aux. | Auxiliary script | ||
bootstrap.app.php | Aux. | Auxiliary script | ||
config.app.php | Aux. | Auxiliary script |
Files (70) | / | app | / | Articles |
File | Role | Description | ||
---|---|---|---|---|
Application (1 file) | ||||
DataMapper (1 file) | ||||
Model (1 file) | ||||
Service (6 files) | ||||
_database (2 files) |
Files (70) | / | app | / | Articles | / | Service |
File | Role | Description |
---|---|---|
CreateNewArticle.php | Class | Class source |
DeleteExistingArticle.php | Class | Class source |
FindExistingArticle.php | Class | Class source |
ListApiUsageOptions.php | Class | Class source |
UpdateExistingArticle.php | Class | Class source |
WriteAllowedRequestMethods.php | Class | Class source |
Files (70) | / | app | / | Articles | / | _database |
File | Role | Description |
---|---|---|
blog-production.db | Data | Auxiliary data |
create-table.sql | Data | Auxiliary data |
Files (70) | / | tests |
File | Role | Description | ||
---|---|---|---|---|
api (1 file, 4 directories) | ||||
_data (1 file, 1 directory) | ||||
_support (4 files, 2 directories) | ||||
api.suite.yml | Data | Auxiliary data | ||
_bootstrap.php | Aux. | Auxiliary script |
Files (70) | / | tests | / | api |
File | Role | Description | ||
---|---|---|---|---|
Create (4 files) | ||||
Delete (3 files) | ||||
Find (3 files) | ||||
Update (1 file) | ||||
_bootstrap.php | Aux. | Auxiliary script |
Files (70) | / | tests | / | api | / | Create |
File | Role | Description |
---|---|---|
AndFindArticleCept.php | Example | Example script |
ArticleCept.php | Example | Example script |
ArticleWithBadParamsNamesCept.php | Example | Example script |
ArticleWithBadParamsValuesCept.php | Example | Example script |
Files (70) | / | tests | / | api | / | Delete |
File | Role | Description |
---|---|---|
AnExistingArticleCept.php | Example | Example script |
ArticleWithBadIdFormatCept.php | Example | Example script |
NotExistingArticleCept.php | Example | Example script |
Files (70) | / | tests | / | api | / | Find |
File | Role | Description |
---|---|---|
ArticleThatIsNotAtSystemCept.php | Example | Example script |
ArticleUsingBadParamsCept.php | Example | Example script |
ArticleUsingNoParamsCept.php | Example | Example script |
Files (70) | / | tests | / | api | / | Update |
File | Role | Description |
---|---|---|
AnExistingArticleCept.php | Example | Example script |
Files (70) | / | tests | / | _data |
Files (70) | / | tests | / | _data | / | scenarios | / | api |
File | Role | Description |
---|---|---|
Create_And_Find_Article.txt | Doc. | Documentation |
Create_Article.txt | Doc. | Documentation |
Create_Article_With_Bad_Params_Names.txt | Doc. | Documentation |
Create_Article_Wit...d_Params_Values.txt | Doc. | Documentation |
Create_Article_With_No_Params.txt | Doc. | Documentation |
Find_Article_That_Is_Not_At_System.txt | Doc. | Documentation |
Find_Article_Using_Bad_Params.txt | Doc. | Documentation |
Find_Article_Using_No_Params.txt | Doc. | Documentation |
Files (70) | / | tests | / | _support |
File | Role | Description | ||
---|---|---|---|---|
Helper (4 files) | ||||
_generated (4 files) | ||||
AcceptanceTester.php | Class | Class source | ||
ApiTester.php | Class | Class source | ||
FunctionalTester.php | Class | Class source | ||
UnitTester.php | Class | Class source |
Files (70) | / | tests | / | _support | / | Helper |
File | Role | Description |
---|---|---|
Acceptance.php | Class | Class source |
Api.php | Class | Class source |
Functional.php | Class | Class source |
Unit.php | Class | Class source |
Files (70) | / | tests | / | _support | / | _generated |
File | Role | Description |
---|---|---|
AcceptanceTesterActions.php | Class | Class source |
ApiTesterActions.php | Class | Class source |
FunctionalTesterActions.php | Class | Class source |
UnitTesterActions.php | Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
User Ratings | ||||||||||||||||||||||||||||||
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.