PHP code example of scapteinc / lara-veil

1. Go to this page and download the library: Download scapteinc/lara-veil 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/ */

    

scapteinc / lara-veil example snippets


// config/lara-veil.php
return [
    'app' => [
        'name' => 'Lara-Veil',
        'description' => 'Extensibility System',
        'admin_email' => '[email protected]',
        'url' => env('APP_URL'),
    ],
    'features' => [
        'plugins' => ['enabled' => true],
        'themes' => ['enabled' => true],
        'media' => ['enabled' => true],
    ],
    'caching' => [
        'enabled' => true,
        'ttl' => 3600,
    ],
];

// In a plugin or service provider
use Scapteinc\LaraVeil\Core\HookSystem;

app('hook')->addAction('system.init', function() {
    // Custom initialization logic
});

app('hook')->addFilter('media.upload', function($file) {
    // Process before upload
    return $file;
});

// Execute actions
app('hook')->doAction('custom.action', $data);

// Apply filters
$result = app('hook')->applyFilters('custom.filter', $initialValue);

use Scapteinc\LaraVeil\Services\Vrm\MediaForgeService;

$forge = app('media.forge');

// Process images
$results = $forge
    ->upload($request->file('image'))
    ->resize(1920, 1080, keepAspectRatio: true)
    ->compress(quality: 85)
    ->thumbnail([300, 200, 100])
    ->convert('webp', quality: 85)
    ->watermark('assets/logo.png', position: 'bottom-right')
    ->to('media/uploads')
    ->run();

// Delete media
$forge->delete('path/to/file.jpg', type: ['thumbnail', 'converted']);

use Scapteinc\LaraVeil\Models\Plugin;
use Scapteinc\LaraVeil\Models\Theme;
use Scapteinc\LaraVeil\Models\Media;

// Get all active plugins
$active = Plugin::where('is_active', true)->get();

// Get active theme
$theme = Theme::where('is_active', true)->first();

// Get media files
$media = Media::latest()->paginate(15);

// web.php
Route::middleware(['auth'])->prefix('admin')->group(function () {
    Route::get('/', [DashboardController::class, 'index'])->name('dashboard');
    // ... other routes
});

// config/plugin.php
return [
    'name' => 'My Plugin',
    'namespace' => 'vendor/my-plugin',
    'version' => '1.0.0',
    'description' => 'Plugin description',
    'author' => 'Your Name',
];

use Scapteinc\LaraVeil\Managers\PluginManager;

$manager = app('plugin.manager');

// List all plugins
$plugins = $manager->all();

// Activate a plugin
$manager->activate('my-plugin');

// Deactivate a plugin
$manager->deactivate('my-plugin');

use Scapteinc\LaraVeil\Facades\Hook;

// Add an action
Hook::addAction('admin_menu', function() {
    // Custom logic
});

// Apply a filter
$content = Hook::applyFilters('the_content', $post->content);

use Scapteinc\LaraVeil\Services\MediaForgeService;

$media = app('media.forge')
    ->upload($request->file('image'))
    ->resize(1920, 1080)
    ->compress(quality: 85)
    ->thumbnail([[300, 300, 'thumb'], [150, 150, 'mini']])
    ->run();

use Scapteinc\LaraVeil\Managers\ThemeManager;

$manager = app('theme.manager');

// Get active theme
$theme = $manager->active();

// Switch theme
$manager->setActive('dark-theme');

return [
    'plugin' => [
        'paths' => [
            base_path('packages'),
        ],
        'cache' => [
            'enabled' => env('PLUGIN_CACHE', true),
            'ttl' => 3600,
        ],
    ],
    'theme' => [
        'paths' => [
            base_path('themes'),
        ],
    ],
];

return [
    'mediaforge' => [
        'driver' => env('MEDIA_DRIVER', 'auto'), // 'auto', 'gd', 'imagick'
        'default_quality' => 85,
        'default_format' => 'webp',
        'preserve_originals' => true,
    ],
];
bash
php artisan vendor:publish --tag=lara-veil-assets
bash
php artisan vendor:publish --tag=lara-veil-config
bash
# View media statistics
php artisan media:info

# Cleanup missing files
php artisan media:cleanup --dry-run

# Prune old files (older than 30 days)
php artisan media:prune --days=30

# Run diagnostics
php artisan media:diagnose