PHP code example of smitmartijn / laravel-lookbook

1. Go to this page and download the library: Download smitmartijn/laravel-lookbook library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

smitmartijn / laravel-lookbook example snippets




namespace App\Lookbook;

use LaravelLookbook\Support\ComponentPreview;
use Illuminate\Support\Facades\Blade;

class Button extends ComponentPreview
{
   /**
    * @name Primary button
    * @notes This is the button style you should use for most things.
    */
   public function primary()
   {
      return (string) Blade::render(<<<'HTML'
<x-button type="submit">
   Button Text
</x-button>
HTML);
   }

  /**
   * @name Success button
   * @notes
   * Use this button style when a form is filled out successfully, or we want to encourage users to click this.
   *
   * This style uses a `#008000` green color
   */
   public function success()
   {
      return (string) Blade::render(<<<'HTML'
<x-button type="submit" color="success">
   Link Text
</x-button>
HTML);
   }
}

class Button extends ComponentPreview
{
   static public function getName()
   {
      return 'Button Component';
   }
   ...
}
bash
php artisan vendor:publish --provider="LaravelLookbook\LookbookServiceProvider"

# php artisan make:lookbook-component Button
Lookbook component created successfully in app/Lookbook/Button.php