craftcms/laravel-aliases
Provides Craft CMS–style alias support for Laravel. Define and resolve @aliases (e.g. @web, @root) in config and use them to build paths/URLs consistently across environments, keeping code cleaner and avoiding hard‑coded directory strings.
yiisoft/aliases (a utility for managing class/namespace aliases). This is useful for:
register() in AppServiceProvider), ensuring minimal friction with existing Laravel conventions.composer autoloader and Psr-4/classmap configurations already handle most aliasing needs. This package may be overkill unless:
yiisoft/aliases is lightweight and unlikely to clash with Laravel’s core dependencies.AppServiceProvider. No complex setup beyond:
use CraftCMS\LaravelAliases\AliasesServiceProvider;
public function register()
{
$this->app->register(AliasesServiceProvider::class);
}
SplAutoloaderRegister extensions)?craftcms/laravel-aliases (this package).yiisoft/aliases (transitive dependency).laravel/framework, illuminate/support).app->bindAlias()).Vendor\Plugin vs. Vendor\Plugin\Alias).AliasA → AliasB → AliasA).composer.json and run composer update.AliasesServiceProvider in config/app.php.config/aliases.php (if the package supports this) or via app['aliases'] array.'aliases' => [
'App\Legacy' => 'App\Compatibility\LegacyAdapter',
],
class_exists(), app()->make()).yiisoft/aliases for breaking changes (though unlikely).composer.json if the package is unmaintained.SplClassLoader extension).class_not_found exceptions).composer dump-autoload if aliases break after updates.yiisoft/aliases specifics.composer show -a).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Alias resolution fails | ClassNotFoundException |
Fallback to native autoloader or hardcoded paths. |
| Package update breaks compatibility | App crashes or silent failures | Pin versions; test updates in staging. |
| Circular alias dependencies | Infinite loops or memory leaks | Static analysis tools (e.g., PHPStan). |
| Case sensitivity mismatches | Aliases not found | Enforce consistent naming conventions. |
| Unmaintained package | Security/bug risks | Fork or replace with custom solution. |
composer dump-autoload --optimize.How can I help you explore Laravel packages today?