Download the PHP package joefallon/phpsession without Composer

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

phpsession — Simple, predictable PHP session helper

phpsession is a small, well-tested PHP library that wraps the PHP session API and provides two common session-expiration strategies:

It is intentionally tiny, dependency-free, and designed for safe use in web applications where predictable session-expiration and non-blocking session access are important.

Why use phpsession?

Requirements

Installation

Install with Composer (recommended):

or add this to your composer.json and run composer install:

Quick start

The class is namespaced under JoeFallon\PhpSession. Typical usage:

Constructor and configuration

The constructor accepts two optional integer parameters (seconds):

Note: The constructor validates inputs and throws InvalidArgumentException if values are negative or if maxAgeInSecs is less than lastActivityInSecs. This is deliberate: the maximum age must be at least as long as the activity window.

Public API (methods)

Constants

Detailed examples

1) Short-lived session that expires after 30 seconds of inactivity:

2) Max-age-only session (ignore activity):

3) Checking and rotating sessions safely

If you use isMaxAgeTimeoutExpired() or isLastActivityTimeoutExpired() in request logic, prefer to let the session management decide when to destroy the session. Example flow:

Security and best practices

Performance considerations

Testing

This project uses PHPUnit 9.6 for unit tests (the last PHPUnit series that supports PHP 7.4). The repository includes a phpunit.xml.dist and a tests/bootstrap.php bootstrap file.

Install dev dependencies (recommended):

Unix/macOS:

Windows (cmd.exe / PowerShell):

Run the test suite:

Unix/macOS:

Windows (cmd.exe / PowerShell):

Notes and troubleshooting

Continuous Integration

Example GitHub Actions job snippet (runs on Ubuntu):

Contributing

Contributions are welcome. A good contribution path:

  1. Fork the repository.
  2. Create a small, focused branch for your change.
  3. Add tests that cover the behavior you change or add.
  4. Run the test suite and ensure everything is green.
  5. Open a pull request with a clear description of the change.

License

MIT — see the LICENSE file for details.

Acknowledgements

Built by Joe Fallon. The test framework was migrated from the small KissTest runner to PHPUnit 9.6 to keep compatibility with PHP 7.4; thanks to the authors of both projects.

Contact

If you have questions or need help integrating phpsession, open an issue on GitHub: https://github.com/joefallon/phpsession


Built with ❤️ and the KISS principle.


All versions of phpsession with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4.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 joefallon/phpsession contains the following files

Loading the files please wait ...