meema/flysystem-meema

Flysystem adapter for the Meema API


README

Meema for Laravel

The most simple way to integrate Meema and your PHP/Laravel project

Scrutinizer Total Downloads Latest Version License

DocumentationPHP ClientReport a bugFAQDiscord

🐙 Installation

This package contains a Flysystem adapter for Meema.

You can install the package via composer:

composer require meema/flysystem-meema

💡 Usage

The first thing you need to do is get an API Key at Meema.io. An API Key can easily be generated in Meema's Dashboard once you are logged in. For a more detailed step-by-step instructions, explore our documentation here.

use League\Flysystem\Filesystem;
use Meema\Client;
use Meema\FlysystemMeema\MeemaAdapter;

$client = new Client($authorizationToken);

$adapter = new MeemaAdapter($client);

$filesystem = new Filesystem($adapter);

For extending the storage, you have to simply put following into the boot-method of your service provider:

use League\Flysystem\Filesystem;
use Meema\Client as MeemaClient;
use Meema\FlysystemMeema\MeemaAdapter;

/**
 * Bootstrap any application services.
 *
 * @return void
 */
public function boot()
{
    Storage::extend('meema', function ($app, $config) {
        $client = new MeemaClient(
            $config['api_secret']
        );

        return new Filesystem(new MeemaAdapter($client));
    });
}

After extending the storage, you can set meema as the filesystem driver in your .env-file or in your filesystem's config file.

FILESYSTEM_DRIVER=meema
'disks' => [
    // ...
    'meema' => [
        'driver' => 'meema',
        'api_secret' => env('MEEMA_API_SECRET'),
    ],
]

Read more about custom filesystems here.

After extending and defining the filesystem driver, you can then use Laravel's "Storage"-facade as follows:

use Illuminate\Support\Facades\Storage;

$storage = Storage::disk('meema');

$storage->put('photos/image.jpg', $file);
$storage->getMetadata('photos/image.jpg');
$storage->getVisibility('photos/image.jpg');
$storage->setVisibility('photos/image.jpg', 'private');
$storage->path('photos/image.jpg');
$storage->copy('photos/image.jpg', 'photos/copied-image.jpg');
$storage->rename('photos/image.jpg', 'photos/renamed-image.jpg');

🧪 Testing

composer test

📈 Changelog

Please see our releases page for more information on what has changed recently.

💪🏼 Contributing

Please see CONTRIBUTING for details.

🏝 Community

For help, discussion about best practices, or any other conversation that would benefit from being searchable:

Flysystem Meema on GitHub

For casual chit-chat with others using this package:

Join the Meema Discord Server

🚨 Security

Please review our security policy on how to report security vulnerabilities.

🙏🏼 Credits

📄 License

The MIT License (MIT). Please see LICENSE for more information.

Made with ❤️ by Meema, Inc.