Download the PHP package dwendrich/expressive-session-middleware without Composer

On this page you can find all versions of the php package dwendrich/expressive-session-middleware. 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 expressive-session-middleware

expressive-session-middleware

Session handling middleware based on zend-session for use in zend expressive 3 applications.

Build Status Coverage Status Latest Stable Version

PSR-15 Support

This version supports PSR-15 instead of http-interop/http-middleware interfaces, as currently implemented by zend expressive 3. For use with older versions of zend expressive, please refer to version 0.1.9.

Requirements

Installation

Install the latest version with composer. For information on how to get composer or how to use it, please refer to getcomposer.org.

If during installation you are prompted to inject Zend\Session\ConfigProvider into your configuration, you can simply ignore and continue without it. All relevant configuration is part of SessionMiddleware\ConfigProvider.

As part of a zend-expressive application add SessionMiddleware\ConfigProvider::class to config/config.php:

There are two ways of integrating the session middleware into your application.

1. Add the middleware to the programmatic middlewarepipeline

You can add the middleware to the file config/pipeline.php:

Depending on which middleware should get access to the session, you should prepend SessionMiddleware in the pipeline. Commonly before registering the routing middleware is a good way to go.

This way the middleware is invoked on every request to your application. Since session handling may produce some overhead, which isn't always needed, there is an alternative:

2. Add the middleware to a specific route

Add a route definition to either config/routes.php or a RouteDelegator as part of your application:

This way session handling is bound to a specific path in your application where it may be needed.

For further information on programmatic pipelines and routing in zend expressive please refer to the documentation.

Basic usage

Once the session middleware is invoked it will start the session and adds the session manager object as attribute to the current request. Any middleware which processes this request subsequently, can detect that session handling is started by testing against the request attribute:

Storing and retrieving session data

Zend session component uses Container objects to access and store session data. For information on this concept please refer to the documentation.

Following is a simple example on how to use a Container:

In another part of the application you may want to access this data:

Configuration

The session can be configured by adding a session.global.php to your config/autoload path, for example. You can use session.global.php.dist file (see session.global.php.dist) as template.

For possible configuration options please refer to the documentation of zend-session component.

You can override the session configuration instance with any instance or class implementing Zend\Session\Config\ConfigInterface. Simply specify it in session configuration:

For using a certain session storage adapter you can override it in the config, as well. Therefore it has to implement Zend\Session\Storage\StorageInterface:

To add validators to the session manager, you cann define them in the config, too, for example:


All versions of expressive-session-middleware with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
zendframework/zend-session Version ^2.7
zendframework/zend-servicemanager Version ^3.3
psr/http-message Version ^1.0
psr/http-server-middleware Version ^1.0
http-interop/http-middleware Version ^0.4.1
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 dwendrich/expressive-session-middleware contains the following files

Loading the files please wait ....