Download the PHP package drift/server without Composer

On this page you can find all versions of the php package drift/server. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package server

DriftPHP Server

CircleCI

This package provides a ReactPHP based async, reactive and non-blocking server for PHP applications working on top of ReactPHP Promises and PSR standards. The server has a small kernel/application abstraction for an optimized integration for several domain implementations. Here some features.

By default, the server will use the DriftPHP Kernel adapter, but you can change the adapter easily when starting the server (Check the adapters chapter)

Table of content

Installation

You can install the server by adding the dependency in your composer.json file

Start the server

This package provides an async server for DriftPHP framework based on ReactPHP packages and Promise implementation. The server is distributed with all the Symfony based kernel adapters, and can be easily extended for new Kernel modifications.

To start the server, just type this line. Your project might have a custom bin folder, so check it.

You can use as well the short mode, defining only the port and assuming this host 0.0.0.0.

And that's it. You will have a fully working server for your application.

Build your adapter

In order to build your adapter, the only thing you need is to create an implementation of the interface Drift\Server\Adapter\KernelAdapter. This layer will allow the server to start your application, handle each request, locate your static resources and shutdown the application. The ObservableKernel will provide as well some information about where your code is located, specifically designed for the watcher feature.

When you have your adapter created, the is as easy is this to start serving from your application

Custom response output

You can internally use the x-server-message header for custom server messages. The server will remove this server value before returning the response content.

Workers

This server creates a single worker by default. A simple PHP thread that will use one single CPUs. Luckily this server provides you a simple way of creating multiple instances listening the same port, emulating a simple balancer between N threads.

You can guess the number of physical threads your host has by using the value -1. By default, a single worker will be used.

This feature is not designed and intended for production environments. We encourage to use a reversed proxy or a small balancer if you need to balance between several processes. Furthermore, this feature uses pcntl_fork, so as the documentation explains it is not available for Windows users.

Watcher

You can use the watcher by installing the seregazhuk/php-watcher dependency in your composer.

After installing the dependency, you will be able to start your server by checking code changes.

This feature is for development only.

Static server

This server can serve static files as well located in your project. By default, an adapter will provide a path where static files should be found (like DriftPHP statics are located under public/ folder), but you can overwrite this value, or even override it.

You can create an alias as well if you need it. That can be useful if you want to mask the internal path with an external one, only exposing this second one. Both values must be separated by the symbol :, being the first part the alias, and the second one the internal path.

In this example, a file named app.js located under /internal/public/path/ folder will be accessible at http://localhost:8000/public/app.js. By default, this feature is disabled.

Static server cache

You can define your static folder cache by adding a YAML file wherever you want and referencing it when starting the server.

In this file you can define specific headers for all your static resources (in fact, not only cache ones). You can define as well regular expressions for matching them.

By default, this feature is disabled and no extra headers will be added into your static resources.

Important

By default, this package will not install the react/filesystem package. This means that, if you don't install it by hand in your project, all the disk operations will be blocking. These operations done synchronously will be much faster and efficient, but by using large size files could slow down the entire process.

Symfony bridge

In order to help you from migrating an application from Symfony to DriftPHP, assuming that this means that your whole domain should turn on top of Promises, including your infrastructure layer, this server is distributed with a small Symfony adapter. Use it as a tool, and never use it at production (using a ReactPHP based server in a blocking application is something not recommendable at all in terms of performance and service availability). That adapter will help your migrating from one platform to the other, as will allow this server to work with your Symfony kernel.

DriftPHP resources

Some first steps for you!

or


All versions of server with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
ext-pcntl Version *
symfony/http-kernel Version ^5.0
symfony/console Version ^5.0
symfony/finder Version ^4.4 || ^5.0
symfony/yaml Version ^4.4 || ^5.0
react/http Version ^1.0
react/event-loop Version ^1.0
react/socket Version ^1.0
react/promise Version ^2.7
clue/zlib-react Version ^0.2.2
drift/console-bridge Version ^0.1.2
drift/event-loop-utils Version ^0.1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package drift/server contains the following files

Loading the files please wait ....