- How do I install duncan3dc/blade in a standalone PHP project?
- Install it with Composer by requiring duncan3dc/blade, then instantiate the package wrapper and point it at writable view and compiled-template cache directories. You do not need to install the full Laravel framework. A small render call can then output a Blade view with an array of data.
- Which PHP and Illuminate versions does duncan3dc/blade support?
- duncan3dc/blade wraps illuminate/view, so its compatibility is tied to the PHP and Illuminate versions it allows. Pin the package and its Illuminate dependencies together and test against your target PHP runtime. Check the current Composer constraints rather than assuming support for every Laravel version.
- Does duncan3dc/blade support Blade layouts, includes, components and custom directives?
- It supports familiar Blade syntax including layouts, includes, directives and compiled-template caching. Components, slots and custom directives depend on the underlying Illuminate View version, so verify the exact features you need in a proof of concept. Most standard Blade template patterns should carry over.
- Can I use duncan3dc/blade without installing Laravel?
- Yes. duncan3dc/blade is purpose-built to provide Blade as a standalone view layer without routing, dependency injection, ORM, auth or other Laravel framework pieces. It is not a Laravel replacement, but it lets standalone PHP apps and legacy code use Blade templates.
- How do I configure view and compiled template cache paths with duncan3dc/blade?
- Configure one writable directory for your Blade view files and a separate writable directory for compiled templates. Keep both outside the public web root and isolate the cache per environment or tenant. Ensure filesystem permissions and opcache settings are correct before rendering in production.
- Is duncan3dc/blade suitable for production use?
- Rendering risk is generally low, but dependency and maintenance risk is moderate because the package is a small wrapper tied to Illuminate/View releases. It has a niche ecosystem footprint and no implied commercial support, so plan for internal ownership. Pin dependencies, warm compiled templates, add render and escaping tests, and monitor template errors in production.
- How do I deploy and precompile Blade templates with duncan3dc/blade?
- Treat compiled Blade templates as build artifacts: precompile or warm the cache during deployment and enable opcache. For horizontal scaling, use shared cache storage or bake the compiled cache into your images. Avoid compiling templates on every request in production.
- What Laravel helpers are missing when using Blade outside Laravel?
- Blade outside Laravel will not have the full set of Laravel helpers and framework facilities available. You will likely need local helper or directive shims for templates that depend on Laravel-only functions. Laravel's Blade documentation is largely applicable, but standalone edge cases may require reading the package and Illuminate source.
- How does duncan3dc/blade compare to Twig or using full Laravel?
- Choose duncan3dc/blade when you specifically want Blade syntax or need to reuse Laravel-origin templates in a non-Laravel PHP app. It is unnecessary inside a full Laravel application and may be a poor fit where Twig or Symfony conventions already dominate. It is a presentation-layer tool, not a framework replacement.
- How do I test Blade rendering and escaping with duncan3dc/blade?
- Add render tests for representative templates, including layouts, includes, custom directives and escaping behavior. Include template smoke tests in deployment checks and verify that user content is escaped unless explicitly trusted. A proof of concept with your real templates is the best way to catch missing helpers or unsupported features.