Skip to content

Commit

Permalink
Adapter created
Browse files Browse the repository at this point in the history
  • Loading branch information
tanercc committed Feb 28, 2024
1 parent d6d2365 commit c33193b
Show file tree
Hide file tree
Showing 6 changed files with 477 additions and 8 deletions.
9 changes: 3 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
composer.phar
/vendor/

# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
.idea
composer.lock
vendor
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

All notable changes to `flysystem-publitio` will be documented in this file

## 1.0.0 - 2022-09-27

- initial release
19 changes: 19 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
76 changes: 74 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,74 @@
# flysystem-publitio
Publit.io filesystem adapter for Flysystem.

# Flysystem adapter for the Publitio API

This package contains a [Flysystem](https://flysystem.thephpleague.com/) adapter for Publitio.

## Installation

TODO

## Usage

```php
<?php

namespace App\Providers;

use Illuminate\Support\Facades\Storage;
use League\Flysystem\Filesystem;
use Illuminate\Support\ServiceProvider;
use Publitio\API;
use Publitio\FlysystemPublitio\PublitioAdapter;

class PublitioServiceProvider extends ServiceProvider
{
/**
* Register bindings in the container.
*
* @return void
*/
public function register()
{
//
}

/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Storage::extend('publitio', function ($app, $config) {

$client = new API($config['api_key'], $config['api_secret']);
$adapter = new PublitioAdapter($client, $config);

return new Filesystem($adapter);
});
}
}
```
add config > filesystems.php
```
'disks' => [
...
'publitio' => [
'driver' => 'publitio',
'api_key' => env('PUBLITIO_API_KEY', 'JbodQdBHSNvpix0yJAxN'),
'api_secret' => env('PUBLITIO_API_SECRET', 'NPkny339LvH1txSnbQPjMPHMmAhAwLby'),
'domain' => env('PUBLITIO_DOMAIN', 'https://media.publit.io'),
],
```

add config > app.php
```
App\Providers\PublitioServiceProvider::class,
```
## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
32 changes: 32 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "publitio/flysystem-publitio",
"description": "Flysystem Adapter for publit.io",
"keywords": [
"tanercc",
"flysystem-publitio",
"flysystem",
"publitio",
"api"
],
"homepage": "https://github.com/tanercc/flysystem-publitio",
"license": "MIT",
"authors": [
{
"name": "Taner Çetin",
"email": "[email protected]",
"homepage": "https://github.com/tanercc/flysystem-publitio",
"role": "Developer"
}
],
"type": "library",
"autoload": {
"psr-4": {
"Publitio\\FlysystemPublitio\\": "src"
}
},
"require": {
"php": ">7.2",
"league/flysystem": "^1.0",
"publitio/publitio": "0.1"
}
}
Loading

0 comments on commit c33193b

Please sign in to comment.