aibnuhibban/bitbucket-laravel
Composer 安装命令:
composer require aibnuhibban/bitbucket-laravel
包简介
A Laravel package to interact with Bitbucket API, focusing on repository creation.
README 文档
README
Bitbucket Laravel is a Laravel package that integrates with the Bitbucket API to manage repositories, including creating new repositories within a workspace. This package is built on top of bitbucket/client and allows you to use the Bitbucket API in a Laravel-friendly way.
Installation
1. Install via Composer
You can install the package via Composer:
composer require mvilab/bitbucket-laravel
2. Add the Service Provider
Add the service provider to the providers array in config/app.php:
'providers' => [
// Other service providers...
MviLab\BitbucketLaravel\Service\BitbucketLaravelServiceProvider::class,
],
3. Configure the API Token
Add your Bitbucket API Token to the .env file:
BITBUCKET_TOKEN=your-bitbucket-api-token
Ensure the token has the appropriate permissions to access the workspace and create repositories.
Usage
Creating a New Repository
You can use the BitbucketService to create a new repository in Bitbucket. Here's an example of how to use it in a Laravel controller:
use MviLab\BitbucketLaravel\Service\BitbucketService;
class BitbucketController extends Controller
{
protected $bitbucketService;
public function __construct(BitbucketService $bitbucketService)
{
$this->bitbucketService = $bitbucketService;
}
public function createRepo()
{
$workspace = 'your-workspace';
$repoName = 'new-repository';
$options = [
'is_private' => true,
'scm' => 'git', // SCM (Source Control Management), can be 'git' or 'hg'
'description' => 'Repository created via API',
];
$response = $this->bitbucketService->createRepository($workspace, $repoName, $options);
return response()->json($response);
}
}
Parameters for createRepository
$workspace: The name of the workspace in Bitbucket.$repoName: The name of the repository to be created.$options: An array with the repository configurations such as:is_private: Set the repository as private or public.scm: The type of SCM, either'git'or'hg'.description: A description for the repository.
Example Response
If the repository is created successfully, the API will return a JSON response with the details of the newly created repository.
{
"scm": "git",
"website": null,
"has_wiki": false,
"uuid": "{repository-uuid}",
"language": "",
"fork_policy": "no_public_forks",
"created_on": "2024-01-01T12:34:56.789Z",
...
}
Customization
If you need to extend the API functionality, you can easily do so by creating your own wrapper class or extending the service.
Testing
You can test the API functionality using Laravel's testing framework like PHPUnit or Pest.
Contributing
If you find any bugs or want to add new features, feel free to submit a pull request or open an issue.
aibnuhibban/bitbucket-laravel 适用场景与选型建议
aibnuhibban/bitbucket-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.38k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 10 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 aibnuhibban/bitbucket-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 aibnuhibban/bitbucket-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.38k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2024-10-07