dspacelabs / filesystem
This package is abandoned and no longer maintained.
The author suggests using the sonsofphp/filesystem package instead.
Filesystem abstract for PHP
dev-master / 0.1.x-dev
2016-01-17 01:13 UTC
Requires
- dspacelabs/cache: ^0.1@dev
- psr/log: ^1.0
Requires (Dev)
- aws/aws-sdk-php: ^3.4
- mockery/mockery: ~1.0@dev
- monolog/monolog: ^1.16
- phpunit/phpunit: ~4.7
Suggests
- aws/aws-sdk-php: Used to the AmazonS3Adapter
- monolog/monolog: Pass the logger around as if it was a blunt
This package is not auto-updated.
Last update: 2023-11-22 13:41:44 UTC
README
Filesystem is generic PHP wrapper around the filesystem that allows you to setup your application to store files almost anywhere. The problem this solves is that during development you want to store things on disk, next you deploy your application to Heroku and now you are having to deal with messy code that is checking to see if you are on localhost or on a Heroku instance.
Features
- Store assets on:
- Local Disk
- S3
- More coming soon
- Mock Filesystem for testing
- Support for logging using
psr/log
package
Installation
composer require "dspacelabs/filesystem:0.1@dev"
Configuration
Each adapter has it's own configuration, I've tried to document that in the adapter files. Use the source.
Usage
<?php $adapter = new \Dspacelabs\Component\Filesystem\Adapter\LocalAdapter('/tmp'); $filesystem = new \Dspacelabs\Component\Filesystem\Filesystem($adapter); // Everything uses the `dspace` protocol, you can swap out different adapters // but the protocol will always stay the same. $handle = fopen('dspace://file.txt', 'w+'); fwrite($handle, 'testing'); fclose($handle);
$ cat /tmp/file.txt testing
For more usage example, check out the tests directory.
Testing
Just run phpunit
to run all the tests.
phpunit
Change Log
See CHANGELOG.md.
License
See LICENSE.