1. Go to this page and download the library: Download fluxfiles/laravel 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/ */
fluxfiles / laravel example snippets
$token = $fluxFiles->tokenForUser([
'disks' => ['sftp'], // an SFTP disk configured on the FluxFiles server
'allow_chmod' => true, // cPanel-style permissions (default on for SFTP)
'allow_terminal' => true, // SSH terminal — opt-in, off by default
]);
use FluxFiles\Laravel\FluxFilesFacade as FluxFiles;
// For the current authenticated user
$token = FluxFiles::tokenForUser();
// With custom overrides
$token = FluxFiles::token(auth()->id(), [
'perms' => ['read', 'write'],
'disks' => ['local', 's3'],
'prefix' => 'user-123/',
'max_upload' => 20, // MB — per uploaded file
'max_storage' => 1000, // MB — total quota per prefix (0 = unlimited)
'max_files' => 0, // max files per prefix (0 = unlimited)
'allowed_ext' => ['jpg', 'png', 'pdf'], // lowercase, no dot; null = all safe
'ttl' => 7200, // seconds — token lifetime (7200 = 2 hours)
]);
use FluxFiles\Laravel\FluxFilesFacade as FluxFiles;
FluxFiles::token($user, $overrides); // Generate JWT token
FluxFiles::tokenForUser($overrides); // Token for auth user
FluxFiles::endpoint(); // Get FluxFiles URL
FluxFiles::iframeSrc(); // Get iframe source URL
FluxFiles::sdkUrl(); // Get SDK script URL
FluxFiles::licenseInfo(); // License status summary (no HTTP call)
// app/Console/Kernel.php — scheduled check, alert however this app already does
$schedule->call(function () {
$info = FluxFiles::licenseInfo();
if ($info['days_left'] !== null && $info['days_left'] <= 14) {
Log::warning("FluxFiles license expiring in {$info['days_left']} days", $info);
// …or notify a Slack channel, send an email, etc. — whatever this
// app already uses for ops alerts.
}
})->daily();
// Surface it inside whatever admin panel this app already has
// (Nova resource, Filament page, a hand-rolled dashboard widget):
$licenseInfo = FluxFiles::licenseInfo();