PHP code example of natewiebe13 / php-lucide

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

    

natewiebe13 / php-lucide example snippets



$icons = new \Lucide\IconManager();

$icons->getIcon('anchor'); // Returns an Icon object
$html = $icons->getIcon('anchor')->render(); // Returns the icon's html
echo $icons->getIcon('anchor'); // Outputs the icon's html, since it is cast as a string

// Use on the IconManager instance to set default attributes for all icons
$icons->setAttributes(['stroke' => '#fff', 'stroke-width' => 2]);
$icons->setAttribute('stroke', '#fff');

$icons->setSize(24);
$icons->setColor('#fff');
$icons->setWeight(2);
$icons->addCssClass('foo');

// Or use on a single icon to only affect that one
echo $icons->getIcon('alert-triangle')->setColor('red')->setAttribute('data-alert', 'true');

$icons->getIcon('anchor', [], 'Icon of an anchor');

$icon->setAltText('Icon of an anchor');

$icons->addAlias('close-button', 'x');
bash
composer