-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ramesh Mhetre <[email protected]>
- Loading branch information
1 parent
7a93366
commit 2b8546a
Showing
4 changed files
with
170 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Changelog | ||
|
||
All Notable changes to `gliterd/backblaze-b2` will be documented in this file. | ||
|
||
Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles. | ||
|
||
## NEXT - YYYY-MM-DD | ||
|
||
### Added | ||
- Nothing | ||
|
||
### Deprecated | ||
- Nothing | ||
|
||
### Fixed | ||
- Nothing | ||
|
||
### Removed | ||
- Nothing | ||
|
||
### Security | ||
- Nothing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Contributor Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as | ||
contributors and maintainers pledge to making participation in our project and | ||
our community a harassment-free experience for everyone, regardless of age, body | ||
size, disability, ethnicity, gender identity and expression, level of experience, | ||
nationality, personal appearance, race, religion, or sexual identity and | ||
orientation. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment | ||
include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or | ||
advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic | ||
address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a | ||
professional setting | ||
|
||
## Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable | ||
behavior and are expected to take appropriate and fair corrective action in | ||
response to any instances of unacceptable behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or | ||
reject comments, commits, code, wiki edits, issues, and other contributions | ||
that are not aligned to this Code of Conduct, or to ban temporarily or | ||
permanently any contributor for other behaviors that they deem inappropriate, | ||
threatening, offensive, or harmful. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces | ||
when an individual is representing the project or its community. Examples of | ||
representing a project or community include using an official project e-mail | ||
address, posting via an official social media account, or acting as an appointed | ||
representative at an online or offline event. Representation of a project may be | ||
further defined and clarified by project maintainers. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
reported by contacting the project team at `[email protected]`. All | ||
complaints will be reviewed and investigated and will result in a response that | ||
is deemed necessary and appropriate to the circumstances. The project team is | ||
obligated to maintain confidentiality with regard to the reporter of an incident. | ||
Further details of specific enforcement policies may be posted separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good | ||
faith may face temporary or permanent repercussions as determined by other | ||
members of the project's leadership. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, | ||
available at [http://contributor-covenant.org/version/1/4][version] | ||
|
||
[homepage]: http://contributor-covenant.org | ||
[version]: http://contributor-covenant.org/version/1/4/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Contributing | ||
|
||
Contributions are **welcome** and will be fully **credited**. | ||
|
||
We accept contributions via Pull Requests on [Github](https://github.com/mhetreramesh/flysystem-backblaze). | ||
|
||
|
||
## Pull Requests | ||
|
||
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer). | ||
|
||
- **Add tests!** - Your patch won't be accepted if it doesn't have tests. | ||
|
||
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. | ||
|
||
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. | ||
|
||
- **Create feature branches** - Don't ask us to pull from your master branch. | ||
|
||
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. | ||
|
||
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. | ||
|
||
|
||
## Running Tests | ||
|
||
``` bash | ||
$ composer test | ||
``` | ||
|
||
|
||
**Happy coding**! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,28 +18,36 @@ use BackblazeB2\Client; | |
use BackblazeB2\Bucket; | ||
|
||
$client = new Client('accountId', 'applicationKey'); | ||
|
||
// Returns a Bucket object. | ||
``` | ||
#### Returns a bucket details | ||
``` php | ||
$bucket = $client->createBucket([ | ||
'BucketName' => 'my-special-bucket', | ||
'BucketType' => Bucket::TYPE_PRIVATE // or TYPE_PUBLIC | ||
]); | ||
``` | ||
|
||
// Change the bucket to private. Also returns a Bucket object. | ||
#### Change the bucket Type | ||
``` php | ||
$updatedBucket = $client->updateBucket([ | ||
'BucketId' => $bucket->getId(), | ||
'BucketType' => Bucket::TYPE_PUBLIC | ||
]); | ||
``` | ||
|
||
// Retrieve an array of Bucket objects on your account. | ||
#### List all buckets | ||
``` php | ||
$buckets = $client->listBuckets(); | ||
|
||
// Delete a bucket. | ||
``` | ||
#### Delete a bucket | ||
``` php | ||
$client->deleteBucket([ | ||
'BucketId' => '4c2b957661da9c825f465e1b' | ||
'BucketId' => 'YOUR_BUCKET_ID' | ||
]); | ||
``` | ||
|
||
// Upload a file to a bucket. Returns a File object. | ||
#### File Upload | ||
``` php | ||
$file = $client->upload([ | ||
'BucketName' => 'my-special-bucket', | ||
'FileName' => 'path/to/upload/to', | ||
|
@@ -48,8 +56,10 @@ $file = $client->upload([ | |
// The file content can also be provided via a resource. | ||
// 'Body' => fopen('/path/to/input', 'r') | ||
]); | ||
``` | ||
|
||
// Download a file from a bucket. Returns the file content. | ||
#### File Download | ||
``` php | ||
$fileContent = $client->download([ | ||
'FileId' => $file->getId() | ||
|
||
|
@@ -60,42 +70,50 @@ $fileContent = $client->download([ | |
// Can also save directly to a location on disk. This will cause download() to not return file content. | ||
// 'SaveAs' => '/path/to/save/location' | ||
]); | ||
``` | ||
|
||
// Delete a file from a bucket. Returns true or false. | ||
#### File Delete | ||
``` php | ||
$fileDelete = $client->deleteFile([ | ||
'FileId' => $file->getId() | ||
|
||
// Can also identify the file via bucket and path: | ||
// 'BucketName' => 'my-special-bucket', | ||
// 'FileName' => 'path/to/file' | ||
]); | ||
``` | ||
|
||
// Retrieve an array of file objects from a bucket. | ||
#### List all files | ||
``` php | ||
$fileList = $client->listFiles([ | ||
'BucketId' => '4d2dbbe08e1e983c5e6f0d12' | ||
'BucketId' => 'YOUR_BUCKET_ID' | ||
]); | ||
``` | ||
|
||
## Installation | ||
|
||
Installation is via Composer: | ||
|
||
```bash | ||
$ composer require gliterd/backblaze-b2 | ||
``` | ||
## Change log | ||
|
||
## Tests | ||
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. | ||
|
||
Tests are run with PHPUnit. After installing PHPUnit via Composer: | ||
## Testing | ||
|
||
```bash | ||
$ vendor/bin/phpunit | ||
``` | ||
|
||
## Contributors | ||
|
||
Feel free to contribute in any way you can whether that be reporting issues, making suggestions or sending PRs. :) | ||
## Contributing | ||
|
||
Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details. | ||
|
||
## Security | ||
|
||
If you discover any security related issues, please email [email protected] instead of using the issue tracker. | ||
|
||
## Credits | ||
|
||
- [All Contributors][link-contributors] | ||
|
||
## License | ||
|
||
MIT. | ||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |