PHP code example of alfasix / alfakit-media-library

1. Go to this page and download the library: Download alfasix/alfakit-media-library 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/ */

    

alfasix / alfakit-media-library example snippets


use AlfaSix\AlfakitMediaLibrary\MediaLibraryPlugin;

$panel->plugin(MediaLibraryPlugin::make());

use AlfaSix\AlfakitMediaLibrary\Forms\Components\SpatieMediaLibraryFileUpload;
use AlfaSix\AlfakitMediaLibrary\Infolists\Components\SpatieMediaLibraryImageEntry;
use AlfaSix\AlfakitMediaLibrary\Tables\Columns\SpatieMediaLibraryImageColumn;

// Form: new uploads are added to the collection, removed media deleted, the order saved.
SpatieMediaLibraryFileUpload::make('gallery')
    ->collection('gallery')
    ->multiple()
    ->reorderable()
    ->conversion('thumb')
    ->customProperties(['source' => 'admin'])
    ->responsiveImages();

// Table
SpatieMediaLibraryImageColumn::make('cover')->collection('cover')->conversion('thumb')->circular();

// Infolist
SpatieMediaLibraryImageEntry::make('gallery')->collection('gallery')->stacked();