Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uselagoon/lagoon-php-sdk
PHP package for interacting with the Lagoon Hosting System API.
https://github.com/uselagoon/lagoon-php-sdk
composer docker graphql hosting lagoon php
Last synced: 2 months ago
JSON representation
PHP package for interacting with the Lagoon Hosting System API.
- Host: GitHub
- URL: https://github.com/uselagoon/lagoon-php-sdk
- Owner: uselagoon
- Created: 2021-02-23T00:59:02.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-04-03T05:53:07.000Z (almost 2 years ago)
- Last Synced: 2024-10-18T07:32:26.460Z (3 months ago)
- Topics: composer, docker, graphql, hosting, lagoon, php
- Language: PHP
- Homepage: https://docs.lagoon.sh
- Size: 748 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Lagoon PHP SDK
The *Lagoon SDK for PHP* makes it easy for developers to connect their applications to the Lagoon GraphQL service in PHP Code.
## Getting started
Require the package using [Composer](https://getcomposer.org/):
```
composer require uselagoon/lagoon-php-sdk
```## Quick Examples
### Fetch all projects
See [`tests/lagoon-php-sdk-test`](tests/lagoon-php-sdk-test) for a working example. This script is [tested on GitHub](https://github.com/uselagoon/lagoon-php-sdk/actions).
```php
project()->all()->execute();if ($response->hasErrors()) {
throw new \Exception("There were errors returned from the GraphQL API: " . implode(PHP_EOL, $response->errors()));
}
else {
$projects = $response->all();
print "Projects Found: " . count($projects);
}
} catch (\Exception $e) {
print "ERROR: " . $e->getMessage();
exit(1);
}
```### Fetch all project names
``` php
project()->all()->fields(['name'])->execute();
```### Add a project
``` php
$name,
'gitUrl' => $gitUrl,
'openshift' => 2,
'productionEnvironment' => 'master',
'branches' => 'true',
];
$response = $client->project()->add($project)->execute();
```## Developing this Package
This package interacts with the Lagoon Container Hosting System's API.
You need to have a running Lagoon API instance to develop and test against.
This package includes the Lagoon codebase using the `require-dev` section of composer.json in the [`/tests`](./tests) folder.
### Launch Lagoon API Instance.
Run the following commands to download Lagoon source to the `vendor/uselagoon/lagoon` folder.
# Composer install with --dev dependencies. (default behavior)
composer install# Composer install without --dev dependencies.
# Do this to build and release your codebase to production.
composer install --no-dev# Run bin/api-* scripts to start and test the API containers.
bin/api-start
bin/api-test### Tests
The `bin/api-test` script will launch the containers and wait until the API container is available at https://localhost:3000.
The `api-start` script is simply a wrapper for the `make api-development` command inside `uselagoon/lagoon`. This is the same command used by Lagoon developers to work on the API, so a full development environment is available.
## About this Package
This project was originally developed by @steveworley et al in the repo https://github.com/steveworley/lagoon-php-sdk.
It is currently being improved upon to be released as officially supported by the Lagoon Team.