1. Go to this page and download the library: Download whitecube/bem-components 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/ */
whitecube / bem-components example snippets
namespace App\View\Components;
use Illuminate\View\Component;
use Whitecube\BemComponents\HasBemClasses;
class Btn extends Component
{
use HasBemClasses;
public ?string $icon;
public function __construct(?string $icon = null)
{
$this->icon = $icon;
if($this->icon) {
$this->modifier('icon');
}
}
public function render()
{
return view('components.btn');
}
}
$bem('btn__label', 'blue bold')
// OR
$bem('btn__label', ['blue','bold'])
public function __construct(null|string|array $modifiers = [])
{
$this->modifiers($modifiers);
// Now this will work:
if($this->hasModifier('big')) {
// ...
}
}
public function __construct(null|string|array $classnames = [])
{
$this->classes($classnames);
// Now this will work:
if($this->hasClass('ajax')) {
// ...
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.