Installation:
composer require sheaf/cli
Add the package to your composer.json and run composer update.
First Command:
php artisan sheaf:init
Run this in your Laravel project root. Follow the interactive prompts or use flags for non-interactive setup (e.g., --with-dark-mode).
First Use Case: Install a component (e.g., a button) to test integration:
php artisan sheaf:install button
Verify the component appears in your resources/views/components directory and is usable in Blade templates.
Verify Setup:
Check resources/css/sheaf.css and resources/js/sheaf.js for generated files. Test dark mode (if enabled) by toggling the theme switcher.
Component-Driven Development:
sheaf:list to discover components before coding:
php artisan sheaf:list --filter="form"
sheaf:install card → sheaf:install modal).Theme Management:
php artisan vendor:publish --provider="Sheaf\Cli\SheafServiceProvider" --tag="config"
config/sheaf.php to customize theme.colors or theme.transitions.Dependency Resolution:
npm install for Sheaf-managed assets.Blade Integration:
<x-button type="primary">Click Me</x-button>
@props in resources/views/components/button.blade.php.Asset Compilation:
sheaf.css and sheaf.js. Rebuild after changes:
npm run dev # or `npm run build` for production
resources/views/components/custom/ and register it via sheaf:register (if supported in future versions).sheaf:config to toggle features globally (e.g., disable dark mode):
php artisan sheaf:config set dark-mode false
sheaf:init --no-interaction in build steps.PHP/Node Version Mismatches:
php -v && node -v
Tailwindcss Conflicts:
tailwind.config.js exists, Sheaf may skip CSS setup. Merge configs manually or delete tailwind.config.js before sheaf:init.tailwind.config.js, then run sheaf:init --force.Component Overwrites:
resources/views/components/ may be lost during sheaf:install. Use --keep-existing to preserve files (if supported).Dark Mode Flicker:
transition-colors duration-300 to root elements in your CSS.Missing Dependencies:
package.json includes:
"alpinejs": "^3.12.0"
-v flag for detailed logs:
php artisan sheaf:init -v
php artisan cache:clear
php artisan sheaf:cache:clear
storage/logs/sheaf.log.Component Aliases:
Use sheaf:install button --alias="primary-button" to create custom aliases for components.
Partial Updates: Update only specific components (if supported in future):
php artisan sheaf:update button
Local Development: Symlink Sheaf assets for faster iteration:
npm run dev -- --watch
Then link the compiled CSS/JS in your Blade layout:
<link href="{{ mix('css/sheaf.css') }}" rel="stylesheet">
Extending Themes:
Override Sheaf’s CSS variables in your resources/css/app.css:
@layer sheaf {
--sheaf-primary: #3b82f6; /* Override default */
}
Testing:
Use Sheaf’s built-in test helpers (if available) in tests/Feature/SheafTest.php:
use Sheaf\Cli\Testing\Sheaf;
public function test_button_component() {
Sheaf::assertComponentRendered('button');
}
Performance:
Exclude unused components from builds by configuring sheaf.php:
'components' => [
'button' => true,
'modal' => false, // Exclude modal
],
How can I help you explore Laravel packages today?