1. Go to this page and download the library: Download azaharizaman/nexus-storage 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/ */
azaharizaman / nexus-storage example snippets
use Nexus\Storage\Contracts\StorageDriverInterface;
$driver->put('invoices/2024/invoice-001.pdf', $stream);
$driver->get('invoices/2024/invoice-001.pdf');
$driver->exists('invoices/2024/invoice-001.pdf');
$driver->delete('invoices/2024/invoice-001.pdf');
$driver->createDirectory('invoices/2024');
$driver->listFiles('invoices/2024');
use Nexus\Storage\Contracts\PublicUrlGeneratorInterface;
$url = $urlGenerator->getTemporaryUrl('private/contract.pdf', 3600);
// Returns: https://s3.amazonaws.com/bucket/private/contract.pdf?signature=...
use Nexus\Storage\ValueObjects\Visibility;
$visibility = Visibility::Public;
$visibility = Visibility::Private;
use Nexus\Storage\ValueObjects\FileMetadata;
$metadata = new FileMetadata(
path: 'documents/file.pdf',
size: 1024000,
mimeType: 'application/pdf',
lastModified: new \DateTimeImmutable()
);
use Nexus\Storage\Exceptions\FileNotFoundException;
use Nexus\Storage\Exceptions\InvalidPathException;
use Nexus\Storage\Exceptions\StorageException;
try {
$driver->get('missing.pdf');
} catch (FileNotFoundException $e) {
// Handle missing file
} catch (StorageException $e) {
// Handle general storage errors
}
// In Atomy's AppServiceProvider.php
$this->app->singleton(StorageDriverInterface::class, FlysystemDriver::class);
$this->app->singleton(PublicUrlGeneratorInterface::class, S3UrlSigner::class);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.