amphp / Http Server
Licence: mit
A non-blocking HTTP application server for PHP based on Amp.
Stars: ✭ 1,122
Projects that are alternatives of or similar to Http Server
Service Bus
PHP Service Bus (publish-subscribe pattern) implementation
Stars: ✭ 290 (-74.15%)
Mutual labels: async, amphp
Byte Stream
A non-blocking stream abstraction for PHP based on Amp.
Stars: ✭ 208 (-81.46%)
Mutual labels: async, amphp
Falcon
A high-performance web server for Ruby, supporting HTTP/1, HTTP/2 and TLS.
Stars: ✭ 2,058 (+83.42%)
Mutual labels: async, http-server
Netcoreserver
Ultra fast and low latency asynchronous socket server & client C# .NET Core library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
Stars: ✭ 799 (-28.79%)
Mutual labels: async, http-server
Http Kit
http-kit is a minimalist, event-driven, high-performance Clojure HTTP server/client library with WebSocket and asynchronous support
Stars: ✭ 2,234 (+99.11%)
Mutual labels: async, http-server
http-server-static-content
Static content / file serving for Amp's HTTP server.
Stars: ✭ 19 (-98.31%)
Mutual labels: http-server, amphp
Http Client
Async HTTP/1.1+2 client for PHP based on Amp.
Stars: ✭ 553 (-50.71%)
Mutual labels: async, amphp
Cppserver
Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
Stars: ✭ 528 (-52.94%)
Mutual labels: async, http-server
Nasus
Zero-configuration command-line async HTTP files server in Clojure. Like Python's SimpleHTTPServer but scalable.
Stars: ✭ 158 (-85.92%)
Mutual labels: async, http-server
Aiohttp
Asynchronous HTTP client/server framework for asyncio and Python
Stars: ✭ 11,972 (+967.02%)
Mutual labels: async, http-server
Postgres
Async Postgres client for PHP based on Amp.
Stars: ✭ 56 (-95.01%)
Mutual labels: async, amphp
Socket
Non-blocking socket and TLS functionality for PHP based on Amp.
Stars: ✭ 122 (-89.13%)
Mutual labels: async, amphp
Madelineproto
Async PHP client/server API for the telegram MTProto protocol
Stars: ✭ 1,776 (+58.29%)
Mutual labels: async, amphp
Amp
A non-blocking concurrency framework for PHP applications. 🐘
Stars: ✭ 3,457 (+208.11%)
Mutual labels: async, amphp
This package provides a non-blocking HTTP/1.1 and HTTP/2 application server written in PHP based on Amp. Several features are provided in separate packages, such as the WebSocket component.
The packages was previously named amphp/aerys
, but has been renamed to be easier to remember, as many people were having issues with the old name.
Features
- Static file serving
- WebSockets
- Dynamic app endpoint routing
- Request body parser
- Sessions
- Full TLS support
- Customizable GZIP compression
- HTTP/2.0 support
- Middleware hooks
- CORS (3rd party)
Requirements
- PHP 7
Installation
composer require amphp/http-server
Documentation
Example
<?php
use Amp\Http\Server\RequestHandler\CallableRequestHandler;
use Amp\Http\Server\HttpServer;
use Amp\Http\Server\Request;
use Amp\Http\Server\Response;
use Amp\Http\Status;
use Amp\Socket\Server;
use Psr\Log\NullLogger;
// Run this script, then visit http://localhost:1337/ in your browser.
Amp\Loop::run(function () {
$sockets = [
Server::listen("0.0.0.0:1337"),
Server::listen("[::]:1337"),
];
$server = new HttpServer($sockets, new CallableRequestHandler(function (Request $request) {
return new Response(Status::OK, [
"content-type" => "text/plain; charset=utf-8"
], "Hello, World!");
}), new NullLogger);
yield $server->start();
// Stop the server gracefully when SIGINT is received.
// This is technically optional, but it is best to call Server::stop().
Amp\Loop::onSignal(SIGINT, function (string $watcherId) use ($server) {
Amp\Loop::cancel($watcherId);
yield $server->stop();
});
});
php example.php
Contributing
Please read CONTRIBUTING.md
for details on our code of conduct, and the process for submitting pull requests to us.
Security
If you discover any security related issues, please email [email protected]
instead of using the issue tracker.
License
The MIT License (MIT). Please see LICENSE for more information.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].