lifespikes / php-beam
Opinionated PHP bootstrap package for LifeSpikes projects
Installs: 9 465
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- inertiajs/inertia-laravel: ^0.5.4
- innocenzi/laravel-vite: 0.2.*
- dev-master
- 20220410084112
- 20220410084034
- 20220410083956
- 20220410083917
- 20220410083842
- 20220410083807
- 20220410083729
- 20220410083650
- 20220410083614
- 20220410083538
- 20220410083501
- 20220410082717
- 20220410082009
- v0.8.95
- v0.8.94
- v0.8.93
- v0.8.92
- v0.8.38
- v0.8.37
- v0.8.36
- v0.8.35
- v0.8.34
- v0.8.33
- v0.8.32
- v0.8.31
- v0.8.30
- v0.8.27
- v0.8.26
- v0.8.25
- v0.8.24
- v0.8.23
- v0.8.22
- v0.8.21
- v0.8.20
- v0.8.19
- v0.8.18
- v0.8.17
- v0.8.15
- v0.8.11
- v0.8.10
- v0.8.9
- v0.8.8
- v0.8.6
- v0.8.5
- v0.8.4
- v0.8.3
- v0.8.2
- v0.8.1
- v0.8.0
- v0.7.98
- v0.7.97
- v0.7.96
- v0.7.95
- v0.7.94
- v0.7.93
- v0.7.92
- v0.7.91
- v0.7.90
- v0.7.88
- v0.7.86
- v0.7.85
- v0.7.84
- v0.7.83
- v0.7.82
- v0.7.81
- v0.7.80
- v0.7.67
- v0.7.65
- v0.7.64
- v0.7.63
- v0.7.62
- v0.7.61
- v0.7.60
- v0.7.55
- v0.7.54
- v0.7.53
- v0.7.52
- v0.7.51
- v0.7.50
- v0.7.41
- v0.7.40
- v0.7.30
- v0.7.26
- v0.7.25
- v0.7.21
- v0.7.20
- v0.7.12
- v0.7.11
- v0.7.1
- v0.7.0
- v0.6.95
- v0.6.94
- v0.6.93
- v0.6.92
- v0.6.91
- v0.6.9
- v0.6.8
- v0.6.7
- v0.6.6
- v0.6.1
- v0.6.0
- v0.5.9
- v0.5.5
- v0.5.4
- v0.5.3
- v0.5.2
- 0.5.0
- v0.4.8
- v0.4.3
- 0.4.0
- 0.3.5
- 0.3.4
- v0.3.3
This package is auto-updated.
Last update: 2024-11-08 16:06:09 UTC
README
Component of lifespikes/lifespikes
The title gives it away, doesn't it?
A Laravel package that provides a simple way to deploy Inertia applications powered by Vite and React.
Getting Started
Installation
Install the package using Composer:
composer require lifespikes/php-beam
You'll need to install the applicable Inertia, React, and Vite packages
as well. We've included a package.json
that will install those for you if
you use a package manager bridge like Foxy.
While we try to keep everything as agnostic as possible, you might not be able to use our configuration helpers if you use an older version of these tools.
Quick Start
LIVR is a package with an opinionated stack, but everything else is up to you. There are two steps to configure LIVR:
Laravel Config
Our service provider wraps around innocenzi/laravel-vite
and
inertiajs/inertia-laravel
. We provide a standard configuration for both
libraries that should support most installations. You can configure PhpBeam
using by overriding any of the config options found in config/php-beam.php
.
JS Configuration
LIVR comes with a set of TypeScript files you can use to quickly get your environment going.
Simply begin by creating a vite.config.ts
file in your project root, and
import in our config helper:
/* Running vite:tsconfig will provide you with a @php-beam/config alias */ import generateViteConfig from '@php-beam/config'; export default generateViteConfig({ ...customViteConfig })
Our helper will take care of generating the configuration for you. If there's any custom configuration you want to add, you can do so by passing it in as a first argument to the helper.
Root view, pages, and boot
The last step is providing the primary entrypoint and root view for your
Inertia app. By default, our config will look for an entry point in
resources/js/App.tsx
and use its built-in root view.
You can customize any of these by specifying them in your php-beam
config:
return [ 'entry_point' => 'resources/js/App.tsx', 'root_view' => 'php-beam::app', // There are other options you can customize, // be sure to check the config/php-beam.php file // for more information. ];
Usage
Inertia Entrypoints
We've tried to make setting up the entrypoint of your Inertia app as simple
as possible. Once you specify your entrypoint (Or use the default one), you
can use the createInertiaViteApp
helper to set up your Inertia app.
import createInertiaViteApp from '@php-beam/inertia'; createInertiaViteApp( import.meta.glob('./your-pages-dir/**/*.tsx') );
If you want a more custom setup, like setting custom resolving logic, you can use the standard
createInertiaApp
helper. You can still use ourresolvePageComponent
helper for module resolution though!
Environment Configuration
The best way of customizing configuration for LIVR will be using environment variables. Modifying config values directly may cause issues with how LIVR synchronizes settings with its vite helpers.
Here is a list of the env vars you can use to customize LIVR: