meema/meema-client-php

⚡️ 一个功能齐全且速度极快的 PHP API 客户端,用于与 Meema 交互。🐑

0.1.2 2021-05-06 01:24 UTC

README

Meema for PHP

将 Meema 与您的 PHP 项目集成的最简单方法

Scrutinizer Total Downloads Latest Version License

文档Laravel报告错误常见问题解答Discord

🐙 特点

  • 实现完整功能的媒体管理系统最简单的方法
  • 与 Meema API 交互的轻量级和最小化包
  • 支持 PHP ^7.*

💡 使用方法

首先,通过 composer 包管理器安装 Meema PHP API 客户端

composer require meema/meema-client-php

然后,初始化客户端

use Meema\MeemaClient\Client

$client = new Client($meemaApiKey);

使用 Media 模型

$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']);

使用 Folder 模型

$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]);

使用 Tag 模型

$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();

使用 Favorite 模型

$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();

使用 Storage 模型

$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');

为了使用我们任何“即时”图片和视频操作,请参阅更多信息 这里

有关完整文档,请访问 Meema PHP API 客户端

🧪 测试

composer test

📈 更新日志

请参阅我们的 发布 页面,了解最近的变化。

💪🏼 贡献

有关详细信息,请参阅 CONTRIBUTING

🏝 社区

如有帮助,讨论最佳实践,或任何其他有搜索价值的对话

Meema PHP 在 GitHub 上

与其他使用此包的人闲聊

加入 Meema Discord 服务器

🚨 安全性

请查看 我们的安全策略,了解如何报告安全漏洞。

🙏🏼 致谢

📄 许可证

MIT 许可证 (MIT)。请参阅 LICENSE 以获取更多信息。

由 Meema, Inc. 用 ❤️ 制作