Download the PHP package tatter/handlers without Composer

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

Tatter\Handlers

Handler discovery and management, for CodeIgniter 4

Coverage Status

Quick Start

  1. Install with Composer: > composer require tatter/handlers
  2. Create a Factory to identify your handlers
  3. Discover classes from any namespace: $widgets = WidgetFactory::findAll();

Features

Handlers allows developers to define and discover classes of predetermined types across all namespaces; it is essentially a database-free "model" for classes.

Installation

Install easily via Composer to take advantage of CodeIgniter 4's autoloading capabilities and always be up-to-date:

Or, install manually by downloading the source files and adding the directory to app/Config/Autoload.php.

Configuration (optional)

The library's default behavior can be altered by extending its config file. Copy examples/Handlers.php to app/Config/ and follow the instructions in the comments. If no config file is found in app/Config the library will use its own.

Usage

Handlers uses relative paths to discover files that contain handler classes. Create a new folder in your project or module with an appropriate name for your implementation, e.g. app/Widgets/ or src/Reports.

Compatibility

In order for them be discovered as handlers your classes need to have a consistent class or interface type and supply a unique ID via the class constant HANDLER_ID.

Handlers will resolve class extensions by using this handler ID, so if you want your app to "replace" a handler from another namespace then simply extend the original class and leave the HANDLER_ID constant the same.

Factories

Once your handler classes are created you will need a Factory that provides the lookup path and expected class or interface to identify the handlers. Create the new class extending BaseFactory:

You can then use the BaseFactory methods to locate all handler classes or a specific handler by its ID:

Caching

Handlers scans through all namespaces to discover relevant classes. This distributed filesystem read can be costly in large projects, so Handlers will cache the results for an amount of time set in the config file (default: one day). You can disable Caching using the config file by setting $cacheDuration to null.

Often it is a good idea to pre-cache handlers so the filesystem search does not happen on an actual page load. This library includes FactoryFactory, a "Factory to discover other Factories". If you would like your Factories to be discoverable by FactoryFactory and thus their handlers enabled for auto-caching then place your Factory classes in the Factories subfolder and provide them a HANDLER_ID constant like any other handler.

Commands

To assist with FactoryFactory's discovery of your factories and their handlers this library includes two commands that will pre-cache all handler classes and clear the cached values respectively:

Set your cron job to run spark handlers:cache on some interval smaller than the Config $cacheDuration to ensure your handlers are always at hand.

Examples

Here are some other libraries that implement their own Factory class with a set of handlers. Browse their code to get an idea of how you might use Handlers for your own projects.


All versions of handlers with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.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 tatter/handlers contains the following files

Loading the files please wait ....