PHP code example of matteoggl / linnaeus

1. Go to this page and download the library: Download matteoggl/linnaeus 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/ */

    

matteoggl / linnaeus example snippets

 php
$table->string('slug')->unique();
 php
Route::get('/users/{user}', function (App\User $user) {
    return $user->email;
});
 php
php artisan vendor:publish --provider="MatteoGgl\Linnaeus\LinnaeusServiceProvider" --tag="config"
 php
public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);
        $this->linnaeus = LinnaeusOptions::create()
            ->withKey('linnaeus_slug')
            ->withStructure(['color', 'animal'])
            ->withSeparator('_')
            ->generatesOnUpdate()
            ->withInvalidAnimals(['aardvark'])
            ->withInvalidAdjectives(['zany'])
            ->withInvalidColors(['blue']);
    }