Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

protonemedia/laravel-splade-plugin-skeleton

Repository files navigation

Laravel Splade Core - Plugin Skeleton

⚠️ This package is abandoned: Thoughts on Splade: I took a week off to look around and reflect.

How to use the skeleton

This skeleton is based on Spatie's Laravel package skeleton. It's a great starting point for any Laravel package, so be sure to check it out. This skeleton adds some extra features to make it easier to get started with Splade Core.

Installation

First, clone this repository and run the configure.php script:

php configure.php

This will ask you a few questions and then configure the skeleton for you.

Develop environment

The skeleton comes with a Workbench setup. This allows you to build components in a full-blown Laravel application and test them in the browser with Dusk. The configuration script already installed the workbench for you, but you can also install it manually:

composer install
npm install

Then, in the root of the project, run npm run dev to start the Vite development server. This will watch your files and automatically recompile them when you make changes. In another terminal, run composer run serve to start the Laravel HTTP server. This will serve the workbench application on http://localhost:8000.

The default page is a simple Splade component. The workbench view can be found in workbench/resources/views/demo.blade.php. The component itself is in src/Components/Example.php and the Blade view in resources/views/components/example.blade.php.

Making Components

You may create a new Splade component using the make:splade-component command:

./vendor/bin/testbench make:splade-component Avatar

Alternatively, you may use artisan shortcut that's added to the Composer scripts:

composer artisan make:splade-component Avatar

Make sure to add the Component to the array in src/PluginServiceProvider.php:

public function getComponents(): array
{
    return [
        Components\Avatar::class,
        Components\Example::class,
    ];
}

Prepare for production

When you're ready to publish your package, run npm run build. This will build your assets for production and copy the necessary files to the dist directory. You can then publish your package to Packagist. You don't need to publish to npm, as Splade Core will automatically install the package from Packagist.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •