https://github.com/decodelabs/wellspring
PHP autoload management tools
https://github.com/decodelabs/wellspring
autoload php
Last synced: 12 months 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 (over 2 years ago)
- Default Branch: develop
- Last Pushed: 2025-04-14T08:50:25.000Z (about 1 year ago)
- Last Synced: 2025-04-14T09:46:44.115Z (about 1 year ago)
- Topics: autoload, php
- Language: PHP
- Homepage:
- Size: 12.7 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
[](https://packagist.org/packages/decodelabs/wellspring)
[](https://packagist.org/packages/decodelabs/wellspring)
[](https://packagist.org/packages/decodelabs/wellspring)
[](https://github.com/decodelabs/wellspring/actions/workflows/integrate.yml)
[](https://github.com/phpstan/phpstan)
[](https://packagist.org/packages/decodelabs/wellspring)
### PHP autoload management tools
Wellspring provides simple tools to manage and configure autoloaders in PHP.
---
## 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() and spl_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.