1. Go to this page and download the library: Download cambis/silverstripe-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/ */
cambis / silverstripe-inertia example snippets
use SilverStripe\CMS\Controllers\ContentController;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\HTTPResponse;
class PageController extends ContentController
{
/**
* @return HTTPResponse
*/
public function index(HTTPRequest $request) {
return $this->inertia->render('Dashboard', ['prop' => 'value']);
}
}
namespace App\Inertia\Control\Middleware;
use Cambis\Inertia\Control\Middleware\InertiaMiddleware as BaseMiddleware;
use SilverStripe\Control\HTTPRequest;
class InertiaMiddleware extends BaseMiddleware
{
public function version(HTTPRequest $request): ?string
{
// Custom logic here
}
}