Skip to content

⚑️ A fully-featured & blazing-fast PHP API client to interact with all of Meema's functionalities. πŸ‘

License

Notifications You must be signed in to change notification settings

meemalabs/meema-client-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Meema for PHP

The most simple way to integrate Meema and your PHP project

Scrutinizer Total Downloads Latest Version License

Documentation β€’ Laravel β€’ Report a bug β€’ FAQ β€’ Discord

πŸ™ Features

  • Most simple way to implement a fully-functional media management system
  • Thin & minimal package to interact with Meema's API
  • Supports PHP ^7.*

πŸ’‘ Usage

First, install Meema PHP API Client via the composer package manager:

composer require meema/meema-client-php

Then, initialize the Client

use Meema\MeemaClient\Client

$client = new Client($meemaApiKey);

Using the Media model

$client->media()->create('New media name');
$client->media()->get();

// specific uuids
$client->media()->get('11a283ed-a64e-424a-aefc-6aa98971d529', '1556fcb8-693e-4431-8b16-3b2b7bb8fcc7');
$client->media()->search('media-name');

// this will return a Response instance
$media = $client->media()->find('11a283ed-a64e-424a-aefc-6aa98971d529');

// you may chain other methods that require an id
$media->update('updated-media-name')
$media->delete();
$media->archive();
$media->unarchive();
$media->makePrivate();
$media->makePublic();
$media->duplicate();

// Relationships with other models.
// Continuing with the chaining of methods we used earlier.
$media->folders()->get();
$media->folders()->create('New folder name');
$media->folders()->delete('11a283ed-a64e-424a-aefc-6aa98971d529');
$media->tags()->get();
$media->tags()->associate(['name' => 'Tag Name']);
$media->tags()->disassociate(['name' => 'Tag Name']);

Using the Folder model

$client->folders()->create('New folder name');
$client->folders()->get();

// specific uuids
$client->folders()->get('11a283ed-a64e-424a-aefc-6aa98971d529', '1556fcb8-693e-4431-8b16-3b2b7bb8fcc7');
$client->folders()->search('folder-name');

// this will return a Response instance
$folder = $client->folders()->find('11a283ed-a64e-424a-aefc-6aa98971d529');

// you may chain other methods that require an id
$folder->update('updated-folder-name')
$folder->delete();
$folder->archive();
$folder->unarchive();
$folder->duplicate();

// Relationships with other models.
// Continuing with the chaining of methods we used earlier.
$folder->media()->get();
$folder->tags()->get();
$folder->tags()->associate(['tag_id' => 7]);
$folder->tags()->disassociate(['tag_id' => 7]);

Using the Tag model

$client->tags()->get();

// Specific ids
$client->tags()->get(1, 2, 3);

// This will return a Response instance
$tag = $client->tags()->find(1);

// you may chain other methods that require an id
$tag->update('red-500'); // You will have to use tailwind CSS color palletes.
$tag->delete();
$tag->media()->get();

Using the Favorite model

$client->favorites()->create(['name' => 'New Favorite Name', 'icon' => 'favorite-icon']);
$client->favorites()->get();

// specific ids
$client->favorites()->get(1,2,3);

// this will return a Response instance
$favorite = $client->favorites()->find(1);

// you may chain other methods that require an id
$favorite->update(['name' => 'Updated Favorite Name', 'icon' => 'updated-favorite-icon']);
$favorite->delete();

Using the Storage model

$client->storage()->upload('path/to/local/media/file');
$client->storage()->getMetadata('meema/path/to/file.jpg');

$client->storage()->setVisibility('meema/path/to/file.jpg', 'private'); // Or 'public'
$client->storage()->has('meema/path/to/file.jpg');
$client->storage()->delete('meema/path/to/file.jpg');
$client->storage()->copy('meema/path/to/file.jpg', 'meema/path/to/copied-file.jpg');
$client->storage()->rename('meema/path/to/file.jpg', 'meema/path/to/renamed-file.jpg');

$client->storage()->listContents('meema/path');
$client->storage()->makeDirectory('meema/path/new-folder');

In order to use any of our "On-The-Fly" image & video operations, read more here

For the full documentation, visit the Meema PHP API Client.

πŸ§ͺ 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:

Meema PHP 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.