Weave 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

Statamic Dynamic Token Laravel Package

webographen/statamic-dynamic-token

A Statamic addon that brings dynamic tokens to your content, letting you insert and resolve custom placeholders in templates, fields and Antlers. Lightweight, configurable and handy for reusable, personalised content across your site.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install via Composer: composer require <vendor>/<package>. Laravel’s package auto-discovery should register the service provider automatically; if not, add it to config/app.php.
  • Publish the config file: php artisan vendor:publish --tag=<package>-config. Review the generated config/<package>.php for required keys (API credentials, drivers, etc.).
  • First use case: resolve the package’s main service from the container (e.g., app(<PackageService>::class)) or use its facade if provided. For a quick smoke test, call a simple method in a Tinker session.
  • Since v1.0.0 marks the first stable release of the stand-alone package, start with the README and the service provider to understand the public API and how it decouples from Laravel. The stand-alone entry point is worth checking if you plan to reuse the package outside a Laravel app.

Implementation Patterns

  • Dependency injection: Type-hint the package’s contracts or concrete classes in controllers, jobs, and commands. The service provider should bind interfaces to implementations, making it easy to swap or mock in tests.
  • Facade usage: If a facade is provided, use it for terse access in views or legacy code, but prefer injection in new code for testability.
  • Configuration-driven behavior: Publish the config and drive environment-specific values via .env. Use Laravel’s config caching in production, but remember to re-publish or clear cache after changes.
  • Stand-alone integration: When using the package outside Laravel, instantiate its classes directly via Composer’s autoloader and pass configuration explicitly. Avoid Laravel helpers (config(), app()) in that context.
  • Events and queues: If the package dispatches events, listen for them to hook into its lifecycle. For long-running processes, resolve the service per job to avoid stale state.
  • Testing: Bind fake implementations in the container or use the package’s provided testing utilities. The stand-alone nature means you can also unit-test the core classes without booting Laravel.

Gotchas and Tips

  • Version pinning: v1.0.0 is the first stable release. Pin to ^1.0 and review the CHANGELOG for any breaking changes from pre-release versions.
  • Auto-discovery quirks: If you’re on an older Laravel version or using a custom bootstrap, auto-discovery may fail. Manually register the service provider and any facades in config/app.php.
  • Config caching: After publishing or modifying the package config, run php artisan config:clear in development and config:cache in production. Stale config is a common source of confusion.
  • Stand-alone mode limitations: Laravel-specific helpers and facades are unavailable outside Laravel. Ensure your stand-alone code only relies on the package’s explicit dependencies and PSR interfaces.
  • Debugging: Use app()->make() to resolve the package’s classes and inspect bound instances. Enable package-specific logging if available, and check the service provider’s register() and boot() methods for extension points.
  • Extension points: The service provider likely allows binding custom implementations via the container. Look for bind/singleton calls or published interfaces to override default behavior without forking the package.
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.
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin