continuousphp/sdk
Composer 安装命令:
composer require continuousphp/sdk
包简介
PHP SDK to consume continuousphp API
关键字:
README 文档
README
continuousphp SDK enables PHP developers to use continuousphp in their PHP code.
Installation
Install this package through Composer by adding this package in the require section
"require": { "continuousphp/sdk": "~0.3" }
Usage
Initialize the SDK
<?php require 'vendor/autoload.php'; $service = Continuous\Sdk\Service::factory();
Or use an access token to enable private data access
<?php require 'vendor/autoload.php'; $service = Continuous\Sdk\Service::factory(['token' => 'my-access-token']);
Another way to use your access token consist in declaring it in CPHP_TOKEN environment variable
Get your repository list
$projects = $service->getRepositories();
Get your project list
$projects = $service->getProjects();
Get a specific project
$project = $service->getProject([ 'provider' => 'git-hub', 'repository' => 'continuousphp/sdk' ]);
Create a specific project
$project = $service->createProject([ 'provider' => 'git-hub', 'repository' => 'continuousphp/sdk' ]);
Get the deployment pipelines of a specific project
$project = $service->getPipelines([ 'provider' => 'git-hub', 'repository' => 'continuousphp/sdk' ]);
Put a deployment pipelines of a specific project
$project = $service->putPipeline([ 'provider' => 'git-hub', 'repository' => 'continuousphp/sdk', 'ref' => 'refs/heads/master', 'phpVersions' => [ '5.3.3', '5.3.max', '5.4.max', '5.5.max' ], 'preparePhingTargets' => [ 'clean-up', 'setup-env', 'doctrine-proxies' ], 'preDeployPhingTargets' => [ 'clean-up2', 'setup-env2', 'doctrine-proxies2' ], 'preparePhingVariables' => [ 'env' => 'testing', 'hostname' => 'site.com' 'preDeployPhingVariables' => [ 'env' => 'production', 'hostname' => 'site2.com' ], 'prepareShellCommands => [ 'cd /path/to/folder1a; mkdir subfolder1a', 'cd /path/to/folder1b; mkdir subfolder1b' ], 'preDeployShellCommands' => [ 'cd /path/to/folder2a; mkdir subfolder2a', 'cd /path/to/folder2b; mkdir subfolder2b' ], 'deployOnSuccess' => '1', 'createGitHubRelease' => '1', 'packageRootPath' => '/path/to/package/root' 'composerPath' => '/path/to/composer', 'enableComposerCache' => '1', 'runComposerHooksInPrepare' => '1', 'runComposerHooksInPackage' => '1', 'phingPath' => '/path/to/phing' 'enabledTests' => [ [ 'type' => 'phpunit', 'paths' => [ '/path/one', '/path/two' ], 'blocking' => '1', 'phingTargets' => [ 'reset-db', 'insert-fixtures' ], 'phingVariables' => [ 'env' => 'testing', 'hostname' => 'site.com' ], 'shellCommands' => [ 'cd /path/to/folder3a; mkdir subfolder3a', 'cd /path/to/folder3b; mkdir subfolder3b' ] ], [ 'type' => 'atoum', 'paths' => [ '/path/three', '/path/four' ], 'configFiles' => [ '/config/one', '/config/two' ], 'bootstrapFile' => '/path/to/bootstrap/file', 'blocking' => '0', 'phingTargets' => [ 'reset-db2', 'insert-fixtures2' ], 'phingVariables' => [ 'env' => 'staging', 'hostname' => 'site2.com' ] ], [ 'type' => 'phpcs', 'paths' => [ '/path/five', '/path/six' ], 'blocking' => '0', 'phingTargets' => [ 'reset-db2', 'insert-fixtures2' ], 'phingVariables' => [ 'env' => 'staging', 'hostname' => 'site3.com' ], 'container' => '5.3.3' ], [ 'type' => 'codeception', 'paths' => [ '/path/seven', '/path/eight' ], 'blocking' => '1', 'phingTargets => [ 'reset-db3', 'insert-fixtures3' ], 'phingVariables' => [ 'env' => 'production', 'hostname' => 'site4.com' ] ], [ 'type' => 'phpspec', 'paths' => [ '/path/nine', '/path/ten' ], 'blocking' => '1', 'phingTargets' => [ 'reset-db4', 'insert-fixtures4' ], 'phingVariables' => [ 'env' => 'production', 'hostname' => 'site5.com' ] ], [ 'type' => 'phpbench', 'paths' => [ '/path/ten', '/path/eleven' ], 'blocking' => '1', 'phingTargets' => [ 'reset-db5', 'insert-fixtures5' ], 'phingVariables' => [ 'env' => 'staging', 'hostname' => 'site5.com' ] ], [ 'type' => 'behat', 'paths' => [ '/path/ten', '/path/eleven' ], 'blocking' => '1', 'useProgressFormatter' => '1', 'phingTargets' => [ 'reset-db6', 'insert-fixtures6' ], 'phingVariables' => [ 'env' => 'staging', 'hostname' => 'site6.com', ] ] ], 'deployment' => [ 'type' => 'tarball', 'destinations' => [ [ 'name' => 'my first destination', 'url' => '<url1>', 'pullRequest' => '1', ], [ 'name' => 'my second destination', 'url' => '<url2>', 'pullRequest' => '0' ], [ 'name' => 'my third destination', 'url' => '<url3>' ] ] ], 'notificationHooks' => [ [ 'type' => 'slack', 'url' => 'https://slack.com/hook-url1' 'events' => [ 'createBuild' => '1', 'buildSuccess' => '1' ] ], [ 'type' => 'irc', 'url' => 'chat.freenode.net', 'channel' => '#testchannel', | 'port' => '1234', 'events' => [ 'createBuild' => '1', 'buildFail' => '1' ] ] ] ]);
Get the successful and in warning build list for a specific branch
$builds = $service->getBuilds([ 'provider' => 'git-hub', 'repository' => 'continuousphp/sdk', 'ref' => 'refs/heads/master', 'state' => ['complete'], 'result' => ['success', 'warning'] ]);
Start a new build for a specific branch
$builds = $service->startBuild([ 'provider' => 'git-hub', 'repository' => 'continuousphp/sdk', 'ref' => 'refs/heads/master' ]);
Start a new build for a specific Pull Request
$builds = $service->startBuild([ 'provider' => 'git-hub', 'repository' => 'continuousphp/sdk', 'pull_request' => '21' ]);
Get the package download url of the last build
$package = $service->getPackage([ 'provider' => 'git-hub', 'repository' => 'continuousphp/sdk', 'buildId' => $builds['_embedded']['builds'][0]['buildId'], 'packageType' => 'deploy' ]); $url = $package['url'];
Download the package of the last build
$package = $service->downloadPackage([ 'provider' => 'git-hub', 'repository' => 'continuousphp/sdk', 'buildId' => $builds['_embedded']['builds'][0]['buildId'], 'packageType' => 'deploy', 'destination' => '/path-to-destination-folder' ]); $packagePath = $package['path'];
continuousphp/sdk 适用场景与选型建议
continuousphp/sdk 是一款 基于 Gherkin 开发的 Composer 扩展包,目前已累计 48.21k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2015 年 05 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「build」 「tool」 「continuousphp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 continuousphp/sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 continuousphp/sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 continuousphp/sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Detect continuous integration environment and provide unified access to properties of current build
Phing tasks for continuousphp
Backend Google Sign On for Magento 2
An app setting manager tool for laravel nova
A simple library for make Lexer and Parsers to build a language
Dash (LOVE) Docset Builder in PHP (LOVE).
统计信息
- 总下载量: 48.21k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 14
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2015-05-10