Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/transip/transip-api-symfony
This bundle provides an instance of TransipAPI to Symfony's Container.
https://github.com/transip/transip-api-symfony
api bundle rest symfony transip
Last synced: 2 months ago
JSON representation
This bundle provides an instance of TransipAPI to Symfony's Container.
- Host: GitHub
- URL: https://github.com/transip/transip-api-symfony
- Owner: transip
- License: apache-2.0
- Created: 2021-10-26T12:10:09.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-15T12:56:41.000Z (about 1 year ago)
- Last Synced: 2024-11-15T20:41:38.014Z (3 months ago)
- Topics: api, bundle, rest, symfony, transip
- Language: PHP
- Homepage:
- Size: 95.7 KB
- Stars: 1
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TransIP RestAPI bundle for Symfony
This bundle provides an instance of `\Transip\Api\Library\TransipAPI` to Symfony's Container.
## Requirements
The TransIP RestAPI bundle for Symfony requires the following in order to work properly:
* PHP >= 8.0
* [json](https://www.php.net/manual/en/book.json.php) (php extension)
* [openssl](https://www.php.net/manual/en/book.openssl.php) (php extension)## Installation
You can install the RestAPI library using [Composer](http://getcomposer.org/). Run the following command:
```bash
composer require transip/transip-api-symfony
```Then register your bundle in Symfony
```diff
['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
+ Transip\Bundle\RestApi\TransipApiBundle::class => ['all' => true],
];```
Lastly create a config file:
```yaml
# config/packages/transip.yaml
transip_api:
options:
generateWhitelistOnlyTokens: true
authentication:
username: '%env(TRANSIP_USERNAME)%' # The username you use to login onto the Control Panel
privateKey: '%env(TRANSIP_PRIVATE_KEY)%' # Your Private Key create from the Control Panel
````## Getting started
```php
vps()->getAll();
// Authenticate client with Token (account #1)
$apiClient->setToken('some.jwt.token');
// Get all VPSes for account #1
$apiClient->vps()->getAll();
// Request Token with username and private key (account #2)
$token = $apiClient->auth()->createToken(
$transipUsername,
$transipPrivateKey,
false, // Create IP Whitelisted tokens
false, // Create a read only token
'' // Add Token label
'1 day' // Create token expire
);
// Set token in library
$apiClient->setToken($token);
// Get all VPSes for account #2
$apiClient->vps()->getAll();
}
}
```## Use client
For more information about using the TransIP API Client, please look [at its documentation](https://github.com/transip/transip-api-php#get-all-domains)