Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/decodelabs/wellspring
PHP autoload management tools
https://github.com/decodelabs/wellspring
Last synced: 17 days ago
JSON representation
PHP autoload management tools
- Host: GitHub
- URL: https://github.com/decodelabs/wellspring
- Owner: decodelabs
- License: mit
- Created: 2024-03-04T15:13:44.000Z (11 months ago)
- Default Branch: develop
- Last Pushed: 2024-09-04T21:39:33.000Z (5 months ago)
- Last Synced: 2024-12-08T16:17:11.550Z (about 2 months ago)
- Language: PHP
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Wellspring
[![PHP from Packagist](https://img.shields.io/packagist/php-v/decodelabs/wellspring?style=flat)](https://packagist.org/packages/decodelabs/wellspring)
[![Latest Version](https://img.shields.io/packagist/v/decodelabs/wellspring.svg?style=flat)](https://packagist.org/packages/decodelabs/wellspring)
[![Total Downloads](https://img.shields.io/packagist/dt/decodelabs/wellspring.svg?style=flat)](https://packagist.org/packages/decodelabs/wellspring)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/decodelabs/wellspring/integrate.yml?branch=develop)](https://github.com/decodelabs/wellspring/actions/workflows/integrate.yml)
[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-44CC11.svg?longCache=true&style=flat)](https://github.com/phpstan/phpstan)
[![License](https://img.shields.io/packagist/l/decodelabs/wellspring?style=flat)](https://packagist.org/packages/decodelabs/wellspring)### PHP autoload management tools
Wellspring provides simple tools to manage and configure autoloaders in PHP.
_Get news and updates on the [DecodeLabs blog](https://blog.decodelabs.com)._
---
## Installation
Install via Composer:
```bash
composer require decodelabs/wellspring
```## Usage
Use
Wellspring
to register autoloaders with a Priority level - the higher the priority, the earlier the autoloader will be called.The library automatically remaps loaders on the fly when necessary (even when
spl_autoload_register()
andspl_autoload_unregister()
are used directly), ensuring edge-case functionality does not interfere with the intended load order.Any loaders registered without a priority default to
Priority::Medium
, and any with matching priorities will be called in the order they were registered.```php
use DecodeLabs\Wellspring;
use DecodeLabs\Wellspring\Priority;Wellspring::register(function(string $class) {
// This will get called last
}, Priority::Low);Wellspring::register(function(string $class) {
// This will get called first
}, Priority::High);spl_autoload_register(function(string $class) {
// This will get called second
});spl_autoload_call('test');
```## Licensing
Wellspring is licensed under the MIT License. See [LICENSE](./LICENSE) for the full license text.