1. Go to this page and download the library: Download livck/cloud-laravel 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/ */
livck / cloud-laravel example snippets
use LIVCK\Cloud\Builders\ServiceBuilder;
use LIVCK\Cloud\Laravel\Facades\LivckCloud;
$tag = LivckCloud::tags()->ensure('customer', '4711')->tag;
LivckCloud::services()->create(
ServiceBuilder::http('Shop', 'https://shop.example.com')->interval(60)->tags($tag),
);
use LIVCK\Cloud\CloudClientInterface;
final class ProvisionCustomer implements ShouldQueue
{
use Dispatchable, Queueable;
public function __construct(public readonly string $customer) {}
public function handle(CloudClientInterface $cloud): void
{
$cloud->tags()->ensure('customer', $this->customer);
}
}
protected function casts(): array
{
return ['livck_token' => 'encrypted'];
}
use LIVCK\Cloud\Laravel\Facades\LivckCloud;
use LIVCK\Cloud\Testing\MockResponse;
use LIVCK\Cloud\Testing\RecordedRequest;
it('tags a new customer in their own organization', function () {
$fake = LivckCloud::fake([
MockResponse::json(['data' => $tagPayload], 201),
]);
ProvisionCustomer::dispatchSync('4711');
$fake->assertSent(fn (RecordedRequest $request, string $connection) =>
$connection === 'default' && $request->matches('POST', '/v1/tags/ensure'));
});