PHP code example of webkulwp / inertia

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

    

webkulwp / inertia example snippets


use Webkul\Inertia\Inertia;

$inertia = Inertia::instance()
    ->set_version( '1.0.0' )   // string or callable, e.g. a build hash
    ->set_app_id( 'app' );     // container / script id for the default shell

$inertia->render( 'Order', array(
    'orders'  => fn() => fetch_orders(), // lazy: skipped on partial reloads
    'filters' => $filters,
) );

use Webkul\Inertia\Inertia;

$inertia = Inertia::instance()
    ->set_version( MY_PLUGIN_SCRIPT_VERSION )
    ->set_root_view( array( My_Template::instance(), 'render_ui_template' ) );

if ( ! $inertia->is_inertia_request() ) {
    // Assets are only needed for the HTML shell, not for JSON visits.
    my_plugin_enqueue_app_assets();
}

$inertia->render( 'Order', $props );