PHP code example of inventor96 / inertia-mako

1. Go to this page and download the library: Download inventor96/inertia-mako 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/ */

    

inventor96 / inertia-mako example snippets


    [
        'packages' => [
            'web' => [
                inventor96\Inertia\InertiaPackage::class,
            ],
        ],
    ];
    

    $dispatcher->registerGlobalMiddleware(inventor96\Inertia\InertiaMiddleware::class);
    


return [
    /**
     * The view to use when rendering the full HTML page for the
     * initial response to the browser. This config is relative
     * to the `app/resources/views` directory.
     * e.g. `'app'` would resolve to `resources/views/app.tpl.php`.
     */
    'html_template' => 'inertia::default',

    /**
     * The initial title for the full HTML page.
     */
    'title' => 'Loading...',
];


return [
    /**
     * The path to the manifest file generated by Vite.
     * Only needed if you change the default path in Vite,
     * otherwise the key should be omitted entirely.
     */
    //'manifest' => null,

    /**
     * The path to the hot module replacement file generated
     * by Vite. Only needed if you change the default path in
     * Vite, otherwise the key should be omitted entirely.
     */
    //'hot_file' => null,

    /**
     * The base path for the Vite assets. Should match the
     * `base` option in your Vite configuration, but could
     * also point to a CDN or other asset server, if you are
     * serving assets from a different domain.
     */
    'base_path' => '/build/',
];


return ['1.0'];


$head_file = file_get_contents(__DIR__ . '/../../../../.git/HEAD');
if (strpos($head_file, 'ref: ') === 0) {
    $ref_file = trim(substr($head_file, 5));
    if (file_exists(__DIR__.'/../../../../.git/' . $ref_file)) {
        $commit_hash = trim(file_get_contents(__DIR__.'/../../../../.git/' . $ref_file));
    } else {
        // this fallback will only be used if the git commit hash cannot be found.
        // this will cause a full page load on almost every request, so it's not ideal.
        // hopefully this will only be used when you first create your repo, and never again once you've made your first commit.
        $commit_hash = date('YmdHis');
    }
} else {
    $commit_hash = trim($head_file);
}
return [$commit_hash];