Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Aliases

Laravel Aliases Laravel Package

craftcms/laravel-aliases

Laravel integration for Craft CMS aliases. Defines common path/URL aliases and resolves them through Laravel’s config/container so you can use Craft-style alias strings in your app, CLI, and packages with consistent environment-aware values.

View on GitHub
Deep Wiki
Context7

A Laravel wrapper around yiisoft/aliases

Frequently asked questions about Laravel Aliases
How do I install and set up craftcms/laravel-aliases in a Laravel 10+ project?
Run `composer require craftcms/laravel-aliases`, then register the service provider in `AppServiceProvider.php` by adding `$this->app->register(AliasesServiceProvider::class)` to the `register()` method. No additional configuration is needed unless you want to customize default aliases.
What Laravel versions does this package officially support?
The package is confirmed compatible with Laravel 10+ (PHP 8.1+). For older Laravel versions, test thoroughly as the package relies on Laravel’s service container and bootstrapping hooks, which may have breaking changes in earlier releases.
Can I use this package for dynamic runtime aliasing, like switching namespaces based on environment?
Yes, this package leverages Yii’s `yiisoft/aliases` under the hood, which supports dynamic alias resolution. You can define environment-specific aliases in your Laravel config and resolve them at runtime via the service container.
Is there a performance impact compared to Laravel’s native autoloader?
The performance impact is minimal for most use cases. Dynamic alias resolution adds negligible overhead, but in high-throughput systems, benchmark critical paths. For static aliases, Laravel’s native autoloader (PSR-4/classmap) remains more efficient.
How do I define custom aliases for my Laravel application?
Add your aliases to the `aliases` array in your Laravel config (e.g., `config/aliases.php`). The package will automatically resolve them through Laravel’s service container. Example: `'aliases' => ['@myplugin' => base_path('plugins/myplugin')]`.
Will this package work with Yii 2.x modules in a Laravel app?
Yes, this package is designed for hybrid Yii/Laravel architectures. It bridges Yii’s alias system with Laravel’s container, allowing Yii modules to resolve paths/URLs consistently. Test thoroughly for edge cases like case sensitivity or circular dependencies.
Are there any known dependency conflicts with popular Laravel packages?
No known conflicts exist with Laravel’s core or widely used packages (e.g., `laravel/framework`, `illuminate/support`). The package’s sole dependency, `yiisoft/aliases`, is lightweight and isolated from Laravel’s autoloader.
How should I test alias resolution in my Laravel application?
Test alias resolution in unit/integration tests by verifying critical paths, such as service container bindings or facade calls. Use Laravel’s `app()` helper to check if aliases resolve correctly (e.g., `app('path.to.alias')`). Mock the `AliasesServiceProvider` if needed.
What are the risks of using this package if it appears unmaintained?
The lack of stars/issues/recent activity raises red flags for long-term viability. Risks include undisclosed breaking changes or lack of community support. Mitigate by forking the package or implementing a custom solution (e.g., extending `SplAutoloaderRegister`) if critical.
Can I replace this package with a custom autoloader solution if needed?
Yes, if this package proves problematic, you can replace it with a lightweight custom autoloader using `SplAutoloaderRegister` or Laravel’s `ComposerAutoloader::addPsr4()`. Document your custom logic for future maintainers, especially if you rely on dynamic or environment-specific aliases.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core