Download the PHP package robertboes/sidecar-inertia-vite without Composer

On this page you can find all versions of the php package robertboes/sidecar-inertia-vite. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sidecar-inertia-vite

Sidecar SSR for InertiaJS with Vite

🚨 Use this package with caution, as I'm still working on it

This package is based on hammerstonedev/sidecar-inertia. Aaron has done an amazing job with Sidecar and his original package lead me to figure out how to make it work with Vite.

Overview

This package provides a Sidecar function to run Inertia server-side rendering on AWS Lambda.

Sidecar packages, deploys, and executes AWS Lambda functions from your Laravel application.

Enabling SSR

Following the official Inertia docs on enabling SSR is a good place to start, but there are a few things you can skip:

I won't go into detail on how to setup SSR with Vite and Laravel, but the upcoming Inertia docs have more detailed information along with the Laravel docs

By default the SSR gateway is disabled, you can enable this by setting SIDECAR_INERTIA_VITE_ENABLED=true in your .env or by adjusting the configuration file to your liking.

Installation

To require this package, run the following:

This will install Sidecar as well.

Using the Sidecar Gateway

This package automatically overwrites the Inertia SSR gateway if the config sidecar-inertia-vite.ssr_gateway_enabled is true.

If for some reason the gateway isn't properly overwritten you can do this in your own service provider like so:

Publishing Configuration

You can publish the configuration with the following command:

Configuring Sidecar

If you haven't already, you'll need to configure Sidecar.

Publish the sidecar.php configuration file by running

To configure your Sidecar AWS credentials interactively, you can run

The official Sidecar docs go into much further detail.

Now update your config/sidecar.php to include the function shipped with this package.

Updating Your JavaScript

This only covers Vue3, please follow the Inertia docs for Vue2 or React, and please open any issues.

This package assumes you're using a near-stock vite.config.js, which means the paths are defined by the Laravel plugin.

And update your resources/js/ssr.js to look something like this. The specifics may vary based on your application. If you're using Ziggy, you'll want to uncomment the Ziggy stuff. (This is based on the Inertia docs, with slight modifications.)

Bundling / node_modules

By default the config option sidecar-inertia-vite.bundle is set to true. This will bundle your SSR function using @vercel/ncc, which produces a single file and doesn't require the inclusion of the node_modules folder. Using this approach it will generate a single index.mjs file along with dynamically imported modules.

If you wish to not use this you can set the option to false. This will create a Lambda function with roughly the following contents:

Deploying Your SSR Function

After you have added the SSR function to your sidecar.php, you should run php artisan sidecar:deploy --activate to deploy your function.

This will compile your JavaScript for you as a beforeDeployment hook, so you don't have to worry about remembering to do that first.

Debugging SSR

It's recommended that you deploy your Sidecar function locally so that you can test SSR more quickly. You can run php artisan sidecar:deploy --activate from your local machine and your SSR function will be deployed to Lambda.

You can also set debug to true in your config/sidecar-inertia-vite.php file, so that Sidecar will throw exceptions when SSR fails instead of falling back to client-side rendering. This will help you diagnose issues quickly.

A note on Ziggy

I personally don't use Ziggy, but I did try this in a Laravel Jetstream application and everything seemed to work fine. If anything doesn't work or the docs need more explanation, feel free to submit a PR.


All versions of sidecar-inertia-vite with dependencies

PHP Build Version
Package Version
Requires hammerstone/sidecar Version ^0.4
inertiajs/inertia-laravel Version ^0.6
php Version ^8.0
illuminate/support Version ^9|^10
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package robertboes/sidecar-inertia-vite contains the following files

Loading the files please wait ....