1. Go to this page and download the library: Download yggdrasilcloud/core 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/ */
yggdrasilcloud / core example snippets
use App\File\Infrastructure\Storage\Bridge\StorageBridgeInterface;
use App\File\Infrastructure\Storage\StorageConfig;
use App\File\Domain\Port\FileStorageInterface;
final class AzureBridge implements StorageBridgeInterface
{
public function supports(string $driver): bool
{
return $driver === 'azure';
}
public function create(StorageConfig $config): FileStorageInterface
{
$account = $config->get('account');
$container = $config->get('container');
return new AzureStorage($account, $container);
}
}
use App\File\Domain\Port\FileStorageInterface;
final class MyService
{
public function __construct(
private FileStorageInterface $storage,
) {}
public function uploadFile($stream, string $key): void
{
$this->storage->save($stream, $key, 'image/jpeg', -1);
}
}
bash
# Run all tests
docker compose exec php vendor/bin/phpunit
# Run specific test class
docker compose exec php vendor/bin/phpunit tests/Unit/Photo/Domain/Model/PhotoTest.php
# Run with coverage
docker compose exec php vendor/bin/phpunit --coverage-html coverage
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.