PHP code example of gridprinciples / laravel-placeholder-avatars

1. Go to this page and download the library: Download gridprinciples/laravel-placeholder-avatars 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/ */

    

gridprinciples / laravel-placeholder-avatars example snippets


// routes/web.php
use GridPrinciples\PlaceholderAvatars\Facades\PlaceholderAvatars;

PlaceholderAvatars::route('avatar.svg', type: 'beam');

// routes/web.php
use GridPrinciples\PlaceholderAvatars\Facades\PlaceholderAvatars;

PlaceholderAvatars::route('face.svg',
    // which design should render (optional; defaults to "beam")
    type: 'marble',

    // enforce a red color scheme
    colors: ['#440000', '#110000', '#CC0000'],

    // force a circular avatar, a square will never be produced even if requested
    square: false,

    // we are rendering an SVG so this doesn't matter much, but you can set the size
    size: 256,
);