- What does sunaoka/laravel-facade-generator do?
- It adds an Artisan command that scaffolds Laravel facade classes for classes in your application. The generator creates the accessor and docblocks automatically so you can call services statically without writing boilerplate by hand. It is a development-time code-generation utility, not a runtime framework layer.
- How do I install laravel-facade-generator in a Laravel app?
- Install it with Composer, typically as a development dependency, for example composer require --dev sunaoka/laravel-facade-generator. Confirm the exact install and command names in the package README before adopting it. Then run the provided Artisan generation command against one small internal service and review the generated facade before committing it.
- Which Laravel and PHP versions are supported?
- The provided context does not list specific Laravel or PHP version constraints. Check the package composer.json and README for the supported ranges, then validate them against your application's PHP and Laravel versions. Because adoption is low and Laravel version drift is the main compatibility concern, test generation on a feature branch before broader use.
- Does it generate IDE-friendly docblocks for facade autocompletion?
- Yes, the package description says it generates the accessor and docblocks automatically, which is intended to make static calls easier to use and review. You should still inspect the generated docblocks and run static analysis or your IDE helper workflow on the output. Incomplete annotations can affect IDE autocompletion and static analysis, so treat generated docblocks as reviewable code.
- Can I customize the facade stubs or generated output?
- The supplied context does not confirm whether stubs are configurable or publishable. Check the README and package source for stub publishing or configuration options before relying on customization. If customization is limited, establish internal conventions for namespace, accessor, and docblocks and adjust generated files during code review.
- Does it handle namespaced services and container bindings correctly?
- The generator scaffolds the facade accessor, but correctness still depends on using the fully qualified service class and ensuring the class is resolvable from Laravel's container. Review the generated getFacadeAccessor method and test that the underlying service resolves as expected. Treat incorrect accessors, unbound classes, and namespace collisions as failure modes to catch in review and tests.
- Is laravel-facade-generator safe to use in production?
- Runtime risk is low because this is a code-generation utility rather than a runtime dependency. The generated facades are normal Laravel code, so commit only reviewed output and keep the generator itself as a development dependency. Production risk is mainly code quality: unreviewed or stale generated facades can introduce incorrect accessors or misleading docblocks.
- How should I test generated Laravel facades?
- Run your existing application test suite and static analysis against the generated code. Add a focused test that asserts the facade resolves the expected service from the container and that static calls forward to the underlying class. If you generate facades regularly, consider a drift check so stale generated files are caught before merge.
- What are alternatives to using this facade generator?
- You can write Laravel facades manually or continue using constructor injection, which many teams prefer for explicitness and testability. IDE helper tooling can improve annotations for existing facades but does not scaffold the facade class itself. This package is best treated as a productivity tool for teams already using facades, not as a replacement for dependency injection conventions.
- Is this package actively maintained, and what if it is abandoned?
- The assessment notes low adoption, around 16 stars, and likely single-maintainer support, so maintenance risk is elevated. Generated facades remain usable if the package is abandoned because they are ordinary Laravel classes that can be maintained manually. Pin the version, assign internal ownership of stubs and conventions, and verify compatibility after Laravel upgrades.