1. Go to this page and download the library: Download maduser/argon-filesystem 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/ */
maduser / argon-filesystem example snippets
use League\Flysystem\Filesystem;
use League\Flysystem\Local\LocalFilesystemAdapter;
use Maduser\Argon\Container\AbstractServiceProvider;
use Maduser\Argon\Container\ArgonContainer;
use Maduser\Argon\Filesystem\FilesystemDiskRegistry;
use Maduser\Argon\Filesystem\Provider\FilesystemServiceProvider;
final class AppServiceProvider extends AbstractServiceProvider
{
#[\Override]
public function register(ArgonContainer $container): void
{
$container->register(FilesystemServiceProvider::class);
$container->register(StorageServiceProvider::class);
}
}
final class StorageServiceProvider extends AbstractServiceProvider
{
#[\Override]
public function register(ArgonContainer $container): void
{
$basePath = $container->getParameters()->get('basePath');
assert(is_string($basePath));
$container->get(FilesystemDiskRegistry::class)
->add('local', new Filesystem(new LocalFilesystemAdapter($basePath . '/storage/app')))
->setDefault('local');
}
}
use Maduser\Argon\Filesystem\FilesystemManager;
$storage = $container->get(FilesystemManager::class);
$storage->disk('local')->write('notes/hello.txt', 'Argon');
use League\Flysystem\FilesystemOperator;
$filesystem = $container->get(FilesystemOperator::class);
$contents = $filesystem->read('notes/hello.txt');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.