illuminate/view
Illuminate View is Laravel’s templating and view rendering component. It compiles and renders Blade templates, manages view composers and shared data, supports view discovery, caching, and engines, and integrates cleanly with the rest of the Illuminate framework.
Start by installing via Composer: composer require illuminate/view. As a standalone package, it provides Laravel’s view rendering engine outside a full Laravel app. First use case: rendering Blade templates in a microservice or console app by bootstrapping a ViewFactory with a FileViewFinder and FileCompilerEngine. Configure views path and cache path explicitly using the ViewFactory constructor. Begin with a simple Blade template (e.g., resources/views/hello.blade.php) and render it using factory->make('hello', ['name' => 'Taylor']).
ViewFactory::make() for single renders, ViewFactory::share() to inject shared data across all views (e.g., site title, auth user).ViewFactory::composer() to bind view composers (closure or class-based) for dynamic data population per view or namespace.ViewFactory::addLocation() to register multiple view directories—useful for modular apps or bundling views in packages.app() container manually to support @auth, @dump, or custom directives that depend on core services.ViewFactory to avoid overhead unless needed.view() helper is absent—you must resolve ViewFactory from container or instantiate directly.@vite, @csrf) won’t work out-of-the-box; implement custom placeholders or stubs.config('view.compiled.path') (via env var or direct config array) to avoid runtime errors—Blade compiles templates to PHP and stores them there.view() as a global function; use Illuminate\Support\Facades\View facade only if container is booted properly.$factory->getEngine()->getCompiler()->getExpressionTags() to verify Blade is configured correctly—especially if {{ }} or @ tags behave unexpectedly.BladeCompiler to add custom directives (e.g., @humanTime) by extending BladeCompiler and registering via ViewFactory::setBladeCompiler().How can I help you explore Laravel packages today?