1. Go to this page and download the library: Download waaseyaa/inertia library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
waaseyaa / inertia example snippets
// Inertia — static response factory + shared-prop / version state.
Inertia::setVersion(string $version): void
Inertia::getVersion(): string
Inertia::setRenderer(RootTemplateRenderer $renderer): void
Inertia::getRenderer(): RootTemplateRenderer
Inertia::share(string $key, mixed $value): void
Inertia::render(string $component, array $props, bool $encryptHistory = false, bool $clearHistory = false): InertiaResponse
Inertia::reset(): void
// InertiaResponse implements InertiaPageResultInterface — readonly: component, props,
// url, version, encryptHistory, clearHistory, preserveFragment, and the
// deferred/merge/prepend/deepMerge/once prop sets.
public function toPageObject(): array
// InertiaMiddleware — #[AsMiddleware(pipeline: 'http', priority: 20)]
public function __construct(string $version)
public function process(Request $request, HttpHandlerInterface $next): Response
// PropResolver
public static function optional(\Closure $callback): OptionalProp
public function resolve(array $props, array $only = [], array $except = []): array
// RootTemplateRenderer implements InertiaFullPageRendererInterface
public function __construct(?\Closure $template = null, ?ViteAssetManager $assetManager = null)
public function render(array $pageObject): string
// InertiaServiceProvider implements HasMiddlewareInterface
public function register(): void
public function registerWithRoot(?string $root): void
public function middleware(EntityTypeManager $entityTypeManager): array