andach / laravel-view-components
This is my package laravel-view-components
Installs: 693
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/andach/laravel-view-components
Requires
- php: ^8.1
- gehrisandro/tailwind-merge-laravel: ^1.3
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8
- orchestra/testbench: ^8.8
- phpunit/phpunit: ^10.0
README
This is the standard Laravel form components package for Andach Limited. It helps us keep our apps all consistently formatted and branded. It is not likely to be of use to most people in its current state, but has been released open source in the hope that it will help some people learn and understand how to make their own similar packages.
Installation
You can install the package via composer:
composer require andach/laravel-view-components php artisan view-components:install
Then publish the js with:
php artisan vendor:publish --tag=view-components-assets
And if desired, can publish the config and views with:
php artisan vendor:publish --tag=view-components-config php artisan vendor:publish --tag=view-components-views
The config file can then be edited to point the views towards your local copy to modify them if needed.
Tailwind
You will need Tailwind and FontAwesome installed in your laravel project:
npm install tailwindcss @tailwindcss/vite @fortawesome/fontawesome-free npm install
Also update your resources/css/app.css to include:
@import 'tailwindcss'; @import '@fortawesome/fontawesome-free/css/all.css'; @source '../../vendor/andach/laravel-view-components/src/Components/*.php'; @source '../../vendor/andach/laravel-view-components/resources/views/**/*.blade.php'; @source '../../vendor/andach/laravel-view-components/config/view-components.php'; @source '../../config/view-components.php'; @custom-variant dark (&:where(.dark, .dark *));
And your resources/js/app.js
to include:
import './bootstrap'; import '../css/app.css'; import '/node_modules/@fortawesome/fontawesome-free/css/all.min.css'; import Alpine from 'alpinejs' import $ from 'jquery'; window.Alpine = Alpine document.addEventListener('DOMContentLoaded', () => { Alpine.start() }) window.$ = $; window.jQuery = $;
Testing
composer test
License
The MIT License (MIT). Please see License File for more information.