Download the PHP package teofanis/hook-press without Composer

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

HookPress is a Laravel package that uses Composer hooks to automatically discover, filter, and cache classes, traits, and interfaces in your application

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads Licence

HookPress builds a static class map during Composer install/update so your app can look up “discoverable” classes in O(1) time at runtime. No boot-time reflection, no recursive directory scans, no config arrays to maintain.

Why?

I’ve used this in production for a while to auto-discover things like payment methods and populate lists/registries without hand-wiring every class. It’s been handy for pluggable components (drivers, actions, jobs) where “put the class in the right namespace” should be enough.

Typical uses

Requirements

Installation

Publish the config file with:

Wire HookPress to run when composer installs/updates

NOTE: You can use artisan directly if you prefer

This is the contents of the published config file:

How it works

On composer install/update (or php artisan hook-press:build), HookPress scans your Composer classmap, applies your conditions, and writes a single PHP file (or cache entry) with the results.

At runtime you read from that file/cache—no reflection or directory walking.

Usage

Artisan Commands

Conditions & Examples

Available built-in conditions

Condition Purpose Arg Type Example Arg(s) Notes / Behavior
isInstantiable Include only classes that can be instantiated (not abstract/interfaces). none n/a Default when conditions is omitted. Effectively filters out abstract classes and interfaces.
implementsInterface Require the class to implement a specific interface. string (FQCN) App\\Interfaces\\PayoutMethod::class Uses ReflectionClass::implementsInterface(). Pass a fully-qualified interface name.
usesTrait Require the class to use a given trait. string (FQCN) App\\Traits\\Searchable::class Checks ReflectionClass::getTraitNames(). Matches exact trait FQCN.
hasAttribute Require the class to be annotated with a PHP 8 attribute. string (FQCN) App\\Attributes\\Discoverable::class Uses ReflectionClass::getAttributes(). Attribute FQCN must match.
extends Require the class to extend a given parent/base class. string (FQCN) Illuminate\\Database\\Eloquent\\Model::class Uses ReflectionClass::isSubclassOf().
isAbstract Include only abstract classes. none n/a Opposite of isInstantiable for abstracts. Useful if you deliberately want base classes.
isFinal Include only classes declared final. none n/a Uses ReflectionClass::isFinal().
hasMethod Require a method to exist (optionally with constraints). string or array 'process' or ['name' => 'process', 'public' => true, 'static' => false, 'returns' => 'bool'] Array keys supported: name (required), public/protected/private (bool), static (bool), returns ('void' or FQCN/string of return type).
hasProperty Require a property to exist (optionally with constraints). string or array 'driver' or ['name' => 'driver', 'public' => true, 'static' => false, 'type' => 'string'] Array keys supported: name (required), public/protected/private (bool), static (bool), type ('string', 'int', FQCN, etc.).
nameMatches Match FQCN or short class name using a regex. string or array '/Controller$/' or ['pattern' => '/^Bank/', 'short' => true] If you pass an array: pattern is the regex; short: true applies it to the short class name; otherwise it applies to the full-qualified class name (FQCN).

Notes

Examples

Models (non-abstract Eloquent):

Invokables (public __invoke):

Controllers by name:

Extending with your own custom checks

  1. Implement the contract

  2. Reference it by the FQCN (Fully Qualified Class Name) in your config

HookPress resolves unknown condition keys as classes via the container, so no extra registration is needed.

Notes

Build time scales with your classmap size, but it’s a one-off step during Composer or CI.

Runtime lookups are reading from a single array in a PHP file or a cache item.

You can switch to the cache driver if you prefer not to ship a file under bootstrap/cache.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of hook-press with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^9.0||^10.0||^11.0||^12.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 teofanis/hook-press contains the following files

Loading the files please wait ....