1. Go to this page and download the library: Download innmind/scaleway-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
innmind / scaleway-sdk example snippets
use Innmind\OperatingSystem\Factory;
use function Innmind\ScalewaySdk\bootstrap;
use Innmind\ScalewaySdk\{
Tokens\NewToken,
Region,
Server,
Marketplace,
ChooseImage,
};
use function Innmind\Immutable\{
first,
unwrap,
};
$os = Factory::build();
$sdk = bootstrap($os->remote()->http(), $os->clock());
$token = $sdk
->tokens()
->create(NewToken::temporary(
'[email protected]',
'some secret password',
'2FACOD', // if 2FA enabled on your account
));
$organizations = $sdk
->authenticated($token->id())
->users()
->get($token->user())
->organizations();
$organization = first($organizations);
$servers = $sdk
->authenticated($token->id())
->servers(Region::paris1());
$chooseImage = new ChooseImage(
...unwrap($sdk
->authenticated($token->id())
->marketplace()
->images()
->list()),
);
$server = $servers->create(
new Server\Name('my-server'),
$organization,
$chooseImage(
Region::paris1(),
new Marketplace\Image\Name('CentOS 7.6'),
new Marketplace\Product\Server\Name('GP1-XS'),
),
$servers
->authenticated($token->id())
->ips(Region::paris1())
->create($organization),
);
$servers->execute(
$server->id(),
Server\Action::powerOn(),
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.