Download the PHP package linkeddatacenter/usilex without Composer

On this page you can find all versions of the php package linkeddatacenter/usilex. 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 usilex

µSilex

Latest Version on Packagist Scrutinizer Code Quality Code Coverage Build Status

µSilex (aka micro silex) is a micro framework inspired by Pimple and PSR standards. All with less than 100 lines of code!

This project is a try to build a standard middleware framework for developing micro-services and APIs endpoints that require maximum performances with a minimum of memory footprint.

Why Pimple? Because it is lazy, consistent, fast, elegant and small (about 80 lines of code). What else?

Why PSR standards? Because it is a successful community project with a lot of good implementations (psr15-middlewares, Zend stratigility, Guzzle, etc. etc.).

Why µSilex? Silex was a great framework now abandoned in favor of Symfony + Flex. This is good when you need more power and flexibility. But you have to pay a price in terms of complexity and memory footprint. µSilex it is a new project that covers a small subset of the original Silex project: a µSilex Application is just a Pimple Container implementing the PSR-15 specifications. That's it.

As a matter of fact, in the JAMStack, Docker and XaaS era, you can let a lot of conventional framework features to other components in the system application architecture (i.e. caching, authentication, security, monitoring, rendering, etc. etc).

Is µSilex a replacement of Silex? No, but it could be used to build your own "Silex like"framework.

There are alternatives to µSilex? Yes of course. For example, the Zend Expressive component of the Zend Framework shares similar principles. But it is not "container focused" and it is bound to Zend libraries. Besides routing, Zend Expressive implements "piping" as a mechanism for adding middlewares to your application.

µSilex is based on a few principles:

Have a nice day!

Install

compose require linkeddatacenter/usilex

Overview

Basically a µSilex provides the class Application that is a Pimple container that implements both the PSR-15 middleware interface and PSR-11 Container interface.

Middleware is now a very popular topic in the developer community, The idea behind it is “wrapping” your application logic with additional request processing logic, and then chaining as much of those wrappers as you like. So when your server receives a request, it would be first processed by your middlewares, and then after you generate a response it will also be processed by the same set (image from Zend Expressive).

Note that in this model, the traditional routing by controller is just an optional step in the middleware pipeline.

A middleware is a piece of software that implements the PSR-15 middleware interface:

µSilex is not bound to any specific implementations (apart from Pimple) nor to any middleware implementation.

Instead, µSilex realizes a framework to use existing standard implementations. µSilex adopts PSR-7 specifications for HTTP messages, PSR-15 for managing HTTP handles and middleware and PSR-11 for containers.

Usage

To bind µSilex with specific interface specifications, you need to configure some entries in the container:

µSilex Application exposes the run method that realizes typical server process workflow:

If some PHP exceptions are thrown in the process, they are translated in Response by uSilex.exceptionHandler and then emitted by uSilex.responseEmitter.

The signature for uSilex.responseEmitter is function ($response) { echo ....} . The signature for uSilex.exceptionHandler is function ($exception, $request) {}.

There are tons of libraries that implement great reusable middlewares and HTTP handlers that are fully compatible with µSilex. For example see MW library). µSilex is also compatible with a lot of Silex Service Providers and with some Silex Application traits.

You can create your custom framework just selecting the components that fit your needs. This fragment uses the Relay library for PSR-15 http handler and Diactoros for PSR-7 http messages.

the µSilex service providers

out-of-the-box µSilex give to you a set of Service Providers that you can use as a model to implement yours.

Provider\Psr7\DiactorosServiceProvider

Bound a µSilex application to the Zend Diactoros implementation for Psr7 specifications.

Provider\Psr7\GuzzleServiceProvider

Bound a µSilex application to the Guzzle implementation for Psr7 specifications.

Provider\Psr15\RelayServiceProvider

Bound a µSilex application to Relay, a fast, no frill implementation of the PSR-15 specifications.

Provider\Psr15\ZendPipeServiceProvider

Bound a µSilex application to MiddlewarePipe part of the zend-stratigility library Psr15 implementation.

Configuring new service providers

µSilex Service provider are normal Pimple service providers that, optionally, define the method boot. This method will be called only once by the application method boot. Use this feature only if strictly necessary. The boot method is called automatically by the Application run method.

A best practice to write a PSR-15 service provider is to allow users to declare middlewares as Pimple services and to allow users to define the middleware queue (i.e. pipeline) in an array with the name handler.queue. The handler.queue element can also be a service that resolves in an implementation of the iterable interface. For instance:

Other tools

µSilex also provides two ready to use anti-pattern traits: \uSilex\Psr11Trait that implements a PSR-11 interface and \uSilex\ContainerAwareTrait that attach a PSR-11 container (e.g a µSilex Application) to any object.

A complete example

See more examples in the HTML directory.

Developers quick start

Install docker and run

Please see CONTRIBUTING for contributing details.

Credits

µSilex is inspired by the following projects:


All versions of usilex with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1.3
pimple/pimple Version ^3.2
psr/http-message Version ~1.0
psr/http-server-handler Version ~1.0
psr/http-server-middleware Version ~1.0
psr/container Version ^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 linkeddatacenter/usilex contains the following files

Loading the files please wait ....