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 Package

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.

Deep Wiki
Context7

Product Decisions This Supports

  • Feature Development: Accelerates implementation of dynamic path aliasing for assets, configs, or third-party integrations (e.g., config('aliases.app.logos') resolving to /storage/app/public/logos). Reduces hardcoded paths in codebases, improving maintainability.
  • Roadmap Prioritization: Justifies investing in modular architecture by enabling clean separation of concerns (e.g., vendor-agnostic aliasing for plugins/themes). Aligns with trends toward composable Laravel ecosystems.
  • Build vs. Buy: Avoids reinventing aliasing logic (e.g., custom config/aliases.php files or monolithic path resolvers). Low-risk adoption with MIT license and minimal dependencies.
  • Use Cases:
    • Multi-tenant apps: Dynamically resolve tenant-specific paths (e.g., storage/tenant-{id}/uploads).
    • Plugin systems: Let plugins register aliases without polluting global namespace (e.g., vendor.plugin-name::assets).
    • Localization: Serve language-specific assets via aliases (e.g., lang/en/assets).
    • Legacy migration: Gradually replace hardcoded paths in monolithic apps.

When to Consider This Package

  • Look Here If:
    • Your team frequently deals with path resolution complexity (e.g., assets, configs, or third-party libraries).
    • You’re building a modular Laravel app (plugins, themes, or microservices) where path isolation is critical.
    • You need runtime alias overrides (e.g., for testing or environment-specific configs).
    • Your current aliasing solution is brittle (e.g., relies on manual define() calls or global constants).
  • Look Elsewhere If:
    • Your use case is simple (e.g., static paths in a small app; Laravel’s built-in public_path() suffices).
    • You’re using non-Laravel PHP frameworks (this is Laravel-specific).
    • You need advanced caching or performance optimizations beyond basic alias resolution (consider spatie/laravel-config-array or custom caching layers).
    • Your team lacks PHP/Laravel familiarity to integrate lightweight packages.

How to Pitch It (Stakeholders)

For Executives: "This package lets us eliminate hardcoded paths in our Laravel app, reducing tech debt and making it easier to add plugins or scale features. For example, instead of scattering /storage/app/uploads across 50+ files, we’d use config('aliases.app.uploads')—cutting refactoring time by 30% and future-proofing for multi-tenant or modular designs. It’s a low-risk, high-reward tool to clean up our architecture with minimal dev effort."

For Engineering: *"craftcms/laravel-aliases wraps Yii’s robust alias system to give us Laravel-native path resolution with zero boilerplate. Key benefits:

  • Dynamic aliases: Define paths in config/aliases.php or runtime (e.g., Alias::set('app.logos', $tenant->logo_path)).
  • Plugin-friendly: Plugins can register their own namespaces (e.g., plugin.acme::assets) without conflicts.
  • Lightweight: ~50 lines of code, MIT licensed, and maintained. Use case: If we’re building a plugin system or need tenant-specific paths, this replaces hours of custom logic with a 10-minute setup. Pair it with config:cache for zero runtime overhead."*
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4