o6web / asset-manager
System for handling assets on O6 Web Properties sites
Installs: 14
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/o6web/asset-manager
Requires
- php: >=7.4.0
- ext-gd: *
- ext-json: *
- ext-pdo: *
- aws/aws-sdk-php: ^3.0.0
- cjrasmussen/filesystem: ^1.0.0
- cjrasmussen/image: ^2.0.0
- cjrasmussen/string: ^2.0.0
- ralouphie/mimey: ^2.1
Requires (Dev)
- roave/security-advisories: dev-latest
This package is auto-updated.
Last update: 2025-12-26 17:50:48 UTC
README
Package for managing asset files used by O6 Web Properties sites. Prior to version 4.0.0, this was an internal package. We've opened it up in case it proves helpful for anyone else but future development will be based on O6's needs.
Usage
use o6web\AssetManager\AssetManager; use o6web\AssetManager\AssetSource; $assetManager = new AssetManager($pdo); // Asset sources can be local paths or S3 buckets // Source type "static" is meant for files where the filename is unique and the contents don't typically change $source = new AssetSource(['path' => '/path/to/static/files/']); $assetManager->setSource($source, AssetSource::TypeStatic); // Source type "dynamic" is meant for files that change often or need to be associated with a database record, such as user-uploaded files $source = new AssetSource(['s3Client' => $s3Client, 'bucket' => $bucket]); $assetManager->setSource($source, AssetSource::TypeDynamic); // Check if an asset exists $assetManager->assetFileExists($asset_path); // Delete a dynamic asset and remove its record in the `asset` table $assetManager->deleteDynamicAsset($asset_id); // Upload a dynamic asset and create a record for it in the `asset` table $assetManager->uploadDynamicAssetFile($source_path); // Get a local copy of an asset (if necessary) $assetPath = $assetManager->getAssetLocalPath($asset_path, AssetSource::TypeDynamic); // Get the path of the local asset $assetPath->getPath();
Installation
- Add a dependency on o6web/asset-manager to your composer.json file if you use Composer to manage the dependencies of your project:
composer require o6web/asset-manager
Although it's recommended to use Composer, you can actually include the file(s) any way you want.
- Run the
deploy/install.sqlscript to create the necessary database tables.
License
AssetManager is MIT licensed.