Download the PHP package livck/cloud-laravel without Composer

On this page you can find all versions of the php package livck/cloud-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cloud-laravel

LIVCK Cloud for Laravel

Laravel integration for LIVCK Cloud: uptime monitoring and status pages on statuspage.de or your own domain. It builds on the LIVCK Cloud PHP SDK (livck/cloud-php) and adds configuration, a facade, dependency injection, several connections, a fake for tests and an Artisan check. The API itself, with its builders, queries, DTOs, retries and exceptions, is the SDK's; its README covers all of it.

Requirements

Installation

Laravel discovers the service provider and the LivckCloud facade. Put the token into .env:

and check the connection:

To change more than the token, publish the configuration to config/livck-cloud.php:

Usage

The facade speaks for the default connection:

Or type against the SDK's interface and let the container inject it, into a controller's constructor or a job's handle():

Only the job's data is queued; the worker injects the client when the job runs.

Several organizations

A reseller serving several organizations gives each its own connection and token:

A key a connection leaves out takes the SDK's default.

Tokens from your database

A reseller who keeps one token per end customer in their own database needs no connection for each. withToken() takes the settings of the default connection, or of the connection named second, with another token:

build() takes the keys of a connection. What it leaves out comes from the default connection, the token included; a key it passes wins, even with null. An unknown key throws, so a typo cannot go unnoticed:

A blank token throws MissingTokenException instead of falling back to a configured one, so a customer without a token never reaches your own organization. Store the tokens with Laravel's encrypted cast, which keeps them out of the database in plain text:

Each call builds a new client and the manager keeps none; an Octane or queue worker would otherwise hold a client for every customer's token for as long as it runs. Hold the client in a variable for the request or job at hand rather than calling withToken() again for each API call. LivckCloud::fake() covers both, see Testing.

Configuration

Key Default Notes
default default The connection of the facade and of an injected client
connections.*.token LIVCK_CLOUD_TOKEN Required outside of tests
connections.*.base_uri https://api.livck.cloud/v1 https; plain http only for loopback hosts
connections.*.timeout, connect_timeout 30 s, 10 s
connections.*.max_retries 2 Attempts after the first; 0 turns retries off
connections.*.max_retry_after 60 s A longer Retry-After fails at once instead of waiting
connections.*.idempotency true An Idempotency-Key on every POST
connections.*.locale none Accept-Language; app sends the application's locale of the moment
connections.*.user_agent_suffix none Appended to the User-Agent, e.g. my-panel/2.3
connections.*.transport sdk laravel sends through Laravel's HTTP client, see below
log_channel none One debug line per attempt; never a token, never a body
catalog_cache.store, ttl default store, 3600 s For LivckCloud::catalog(); a TTL of 0 turns it off

The shipped configuration reads every key of the default connection from LIVCK_CLOUD_ and the key in upper case (LIVCK_CLOUD_BASE_URI, LIVCK_CLOUD_TRANSPORT, …), the others from LIVCK_CLOUD_LOG_CHANNEL, LIVCK_CLOUD_CATALOG_CACHE_STORE, LIVCK_CLOUD_CATALOG_CACHE_TTL and, for the name of the default connection, LIVCK_CLOUD_CONNECTION. The log channel needs the debug level to show anything.

LivckCloud::catalog() returns the check-type catalog from the cache, fetched once per connection, base URI and locale. Hand it to services()->create() to validate builders without a request each; LivckCloud::checkTypes() always asks the API.

Checking a connection

php artisan livck-cloud:check [connection] calls GET /v1/me and shows the organization, the token's type, abilities and expiry, and the rate limit. /v1/me answers any valid token, so the check then lists the monitoring locations to prove the plan includes API access (with a token that has services.view). It exits with 0 when the connection works, 1 when the API rejects the token (unknown, revoked, a plan without API access) or cannot be reached, and 2 when the configuration is incomplete. php artisan about lists the connections with their base URI and the beginning of each token, never the token itself.

Testing

LivckCloud::fake() swaps every connection for the SDK's fake: the facade, injected clients, named connections and clients from withToken() and build() all answer from one queue, nothing leaves the process, and retries do not sleep. No configured token is needed; a blank one passed to withToken() or build() still throws.

The matcher receives the request and the name of its connection: ondemand (CloudFake::ON_DEMAND) for a client from withToken() or build(). assertNotSent(), assertSentCount() and assertNothingSent() complete the set; these four work on the facade as well (LivckCloud::assertSent(…)). assertNoPendingResponses() checks that every queued response was used, and recorded('customer-b') lists one connection's requests. A request without a queued response throws, so a test never sends more than it planned for. Call fake() before the code under test resolves a client.

Laravel's HTTP client

With transport: 'laravel' (LIVCK_CLOUD_TRANSPORT=laravel) a connection sends through Laravel's HTTP client. Http::fake() then answers its requests, Http::preventStrayRequests() refuses them, Http::assertSent() sees them, Pulse records slow ones and Telescope lists them (with the Authorization header hidden, as Telescope hides it by default). Retries, idempotency and error mapping stay with the SDK; Http::globalOptions() does not apply, the connection's timeouts do. LivckCloud::fake() takes precedence over both transports.

Octane and queue workers

The clients are immutable and hold no request state, so the manager builds each connection once and every request of an Octane worker and every job of a queue worker reuses it. It reads configuration and locale from the application of the moment, so with locale: 'app' each request gets its own language. Resolve such a client where you use it (the facade, a controller, a job) rather than into a singleton built while the application boots, and call LivckCloud::purge() after changing a connection at runtime. Clients from withToken() and build() are never kept, see Tokens from your database.

User-Agent

Every request names the SDK, then this package and the Laravel version, then your suffix:

Links

License

MIT. See LICENSE.


All versions of cloud-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
guzzlehttp/guzzle Version ^7.8.2 || ^8.0
illuminate/console Version ^12.0 || ^13.0
illuminate/container Version ^12.0 || ^13.0
illuminate/contracts Version ^12.0 || ^13.0
illuminate/http Version ^12.0 || ^13.0
illuminate/log Version ^12.0 || ^13.0
illuminate/support Version ^12.0 || ^13.0
livck/cloud-php Version ^1.2
psr/http-client Version ^1.0
psr/http-message Version ^1.1 || ^2.0
psr/log Version ^2.0 || ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package livck/cloud-laravel contains the following files

Loading the files please wait ...