PHP code example of baine / php-computed-styles

1. Go to this page and download the library: Download baine/php-computed-styles 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/ */

    

baine / php-computed-styles example snippets




use Baine\PhpComputedStyles\ComputedClasses;

...


$classes = ComputedClasses::make([
    'flex',
    'rounded',
    'text-blue' => $user->likesBlue()
])
    ->when($success, [
        'bg-success',
        'text-white'
    ])->whenNot($user->isAdmin(), [
        'bg-disabled'
    ]);




use Baine\PhpComputedStyles\ComputedStyles;

...

$styles = ComputedStyles::make([
    'display' => 'flex',
    'justify-content' => 'center'
])
    ->when($success, [
        'justify-content' => 'start'
    ])->whenNot($user->isAdmin(), [
        'color' => 'grey'
    ]);

bash
composer