platformsh / client
Platform.sh API client
Installs: 236 368
Dependents: 3
Suggesters: 0
Security: 0
Stars: 25
Watchers: 11
Forks: 27
Open Issues: 14
Requires
- php: >=7.2.5
- ext-json: *
- cocur/slugify: ^3.0
- guzzlehttp/guzzle: ^6.3 || ^7.0
- khill/php-duration: ^1.1
- platformsh/oauth2: >=0.0.3 <2
Requires (Dev)
- phpunit/phpunit: ^7.0
- 2.x-dev
- 2.6.0-beta3
- 2.6.0-beta2
- 2.6.0-beta1
- 2.5.1
- 2.5.0
- 2.4.1
- 2.4.0
- 2.3.0
- 2.2.0
- 2.1.0
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 2.0.0-beta10
- 2.0.0-beta9
- 2.0.0-beta8
- 2.0.0-beta7
- 2.0.0-beta.6
- 2.0.0-beta.5
- 2.0.0-beta.4
- 2.0.0-beta.3
- 2.0.0-beta.2
- 2.0.0-beta.1
- 2.0.0-beta.0
- 1.x-dev
- 0.86.0
- 0.85.1
- 0.85.0
- 0.84.0
- 0.83.0
- 0.82.1
- 0.82.0
- 0.81.1
- 0.81.0
- 0.80.1
- 0.80.0
- 0.79.6
- 0.79.5
- 0.79.4
- 0.79.3
- 0.79.2
- 0.79.1
- 0.79.0
- 0.78.1
- 0.78.0
- 0.77.0
- 0.76.0
- 0.75.0
- 0.74.0
- 0.73.0
- 0.72.0
- 0.71.3
- 0.71.2
- 0.71.1
- 0.71.0
- 0.70.1
- 0.70.0
- 0.69.1
- 0.69.0
- 0.68.0
- 0.67.0
- 0.66.0
- 0.65.1
- 0.65.0
- 0.64.0
- 0.63.1
- 0.63.0
- 0.62.2
- 0.62.1
- 0.62.0
- 0.61.0
- 0.60.0
- 0.59.0
- 0.58.0
- 0.57.0
- 0.56.0
- 0.55.4
- 0.55.3
- 0.55.2
- 0.55.1
- 0.55.0
- 0.54.0
- 0.53.1
- 0.53.0
- 0.52.1
- 0.52.0
- 0.51.0
- 0.50.0
- 0.49.0
- 0.48.1
- 0.48.0
- 0.47.0
- 0.46.0
- 0.45.0
- 0.44.0
- 0.43.0
- 0.42.0
- 0.41.1
- 0.41.0
- 0.40.0
- 0.39.0
- 0.38.1
- 0.38.0
- v0.37.2
- v0.37.1
- v0.37.0
- 0.36.0
- v0.35.2
- v0.35.1
- v0.35.0
- v0.34.0
- v0.33.0
- v0.32.3
- v0.32.2
- v0.32.1
- v0.32.0
- v0.31.2
- v0.31.1
- v0.31.0
- v0.30.3
- v0.30.2
- v0.30.1
- v0.30.0
- v0.29.3
- v0.29.2
- v0.29.1
- v0.29.0
- v0.28.1
- v0.28.0
- v0.27.0
- v0.26.1
- v0.26.0
- v0.25.2
- v0.25.1
- v0.25.0
- v0.24.1
- v0.24.0
- v0.23.6
- v0.23.5
- v0.23.4
- v0.23.3
- v0.23.2
- v0.23.1
- v0.23.0
- v0.22.3
- v0.22.2
- v0.22.1
- v0.22.0
- v0.21.0
- v0.20.2
- v0.20.1
- v0.20.0
- v0.19.2
- v0.19.1
- v0.19.0
- v0.18.0
- v0.17.2
- v0.17.1
- v0.17.0
- v0.16.4
- v0.16.3
- v0.16.2
- v0.16.1
- v0.16.0
- v0.15.0
- v0.14.1
- v0.14.0
- v0.13.7
- v0.13.6
- v0.13.5
- v0.13.4
- v0.13.3
- v0.13.2
- v0.13.1
- v0.13.0
- v0.12.1
- v0.12.0
- v0.11.4
- v0.11.3
- v0.11.2
- v0.11.1
- v0.11.0
- v0.10.3
- v0.10.2
- v0.10.1
- v0.10.0
- v0.9.1
- v0.9.0
- v0.8.2
- v0.8.1
- v0.8.0
- v0.7.0
- v0.6.1
- v0.6.0
- v0.5.8
- v0.5.7
- v0.5.6
- v0.5.5
- v0.5.4
- v0.5.3
- v0.5.2
- v0.5.1
- v0.5.0
- v0.4.4
- v0.4.3
- v0.4.2
- v0.4.1
- v0.4.0
- v0.3.5
- v0.3.4
- v0.3.3
- v0.3.2
- v0.3.1
- v0.3.0
- v0.2.1
- v0.2.0
- v0.1.34
- v0.1.33
- v0.1.32
- v0.1.31
- v0.1.30
- v0.1.29
- v0.1.28
- v0.1.27
- v0.1.26
- v0.1.25
- v0.1.24
- v0.1.23
- v0.1.22
- v0.1.21
- v0.1.20
- v0.1.19
- 0.1.18
- v0.1.18-alpha
- v0.1.17
- v0.1.16
- v0.1.15
- v0.1.14
- v0.1.13
- v0.1.12
- 0.1.11
- v0.1.10
- v0.1.9
- v0.1.8
- v0.1.7
- v0.1.6
- v0.1.5
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
- dev-backup-restore
- dev-team-support
- dev-project-user-access
- dev-resource-parent-collection
- dev-remove-pre-auth-code
- dev-port-1.x
- dev-next-deployment
- dev-extended-access
- dev-merge-1-x-2-x
- dev-capabilities
- dev-master
- dev-new-activities-filters
This package is auto-updated.
Last update: 2024-10-15 15:30:05 UTC
README
This is a PHP library for accessing the Platform.sh API.
We recommend you use the Platform.sh CLI (which uses this library) for most purposes.
Versions
- The
2.x
branch (major version 2) requires PHP 7.2.5 and above. - The
1.x
branch (any version < 2) supports PHP 5.5.9 and above, and uses Guzzle 5. Old PHP versions are supported by the Platform.sh CLI, which is why this branch is still maintained.
Install
composer require platformsh/client
Usage
Example:
use Platformsh\Client\PlatformClient; // Initialize the client. $client = new PlatformClient(); // Set the API token to use. // // N.B. you must keep your API token(s) safe! $client->getConnector()->setApiToken($myToken, 'exchange'); // Get the user's first project. $projects = $client->getProjects(); $project = reset($projects); if ($project) { // Get the default (production) environment. $environment = $project->getEnvironment($project->default_branch); // Create a new branch. $activity = $environment->branch('Sprint 1', 'sprint-1'); // Wait for the activity to complete. $activity->wait(); // Get the new branch. $sprint1 = $project->getEnvironment('sprint-1'); }
Creating a project:
use \Platformsh\Client\Model\Subscription\SubscriptionOptions; $subscription = $client->createSubscription(SubscriptionOptions::fromArray([ 'project_region' => 'uk-1.platform.sh', 'project_title' => 'My project', 'plan' => 'development', 'default_branch' => 'main', ])); echo "Created subscription $subscription->id, waiting for it to activate...\n"; $subscription->wait(); $project = $subscription->getProject(); echo "The project is now active: $project->id\n"; echo "Git URI: " . $project->getGitUrl() . "\n";