PHP code example of hirasso / attr
1. Go to this page and download the library: Download hirasso/attr 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/ */
hirasso / attr example snippets
<button <?= attr([
'type' => 'button',
'class' => [
'button button--primary' => true,
'button--active' => $is_active
],
'style' => [
'--color' => 'red'
],
'data-toggle' => true
])
/** Example: render an attribute to be used by Alpine.js */
<div <?= attr([
'x-data' => jsonAttr([
'open' => true,
"message" => "This 'quote' is <b>bold</b>"
])
])