Download the PHP package hammerstone/flaky without Composer

On this page you can find all versions of the php package hammerstone/flaky. 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 flaky

Flaky for Laravel

Flaky for Laravel is a package that helps you handle operations that may have intermittent failures due to unreliable third-parties.

This is very much in beta! Please open issues / PRs for any problems.

Installation

You can install the package via Composer

Usage

Let's say you have a flaky piece of code that fails 20% of the time:

But you don't care if it fails, as long as it doesn't fail for more than an hour. Then you could wrap that code up in Flaky protections.

Now, exceptions will be silenced unless the operation hasn't succeeded in an hour.

Each instance of flaky code requires a unique ID passed through to the make method. This is how we keep track of failures over time. You can make up whatever you want, it's just a cache key.

Flaky uses your default cache store. That may need to be configurable in the future.

Throwing Exceptions

You have several different ways to control when exceptions are thrown:

Time Based

If you want to throw an exception after a certain period of time, you have several methods available to you.

If your callback throws an exception, Flaky will check to see if it's still within the grace period. If it is, the exception will be captured.

If your callback succeeds, the deadline will be reset.

Consecutive Failures

If you'd prefer to take a numeric approach instead of a time-based approach, you can use the allowConsecutiveFailures method.

Now your function can fail 10 times in a row without alerting you, but on the 11th failure the exception will be thrown. If the callback succeeds, the consecutive failure counter will be reset.

Total Failures

If you want to throw an exception after a total number of failures, regardless of successes, you can use the allowTotalFailures method.

On the 11th failure, the exception will be thrown. The counter will be reset only after the exception has been thrown, but not for successful invocations. You can think of this as "Throw every 11th exception, regardless of successes."

Combining

You can combine the three methods in any way you like.

Reporting instead of throwing

By default, Flaky will actually throw the exception if it occurs outside of the bounds you have define. You can choose to report that exception instead of throw it, using Laravel's report method.

This allows you to still get the alert, but carry on processing if you need to. (This is helpful for loops or long-running processes.)

Retrying

If you want to immediately retry a bit of flaky code, you can use the retry method, which uses Laravel's retry helper under the hood. Any failures that happen as a part of the retry process don't count toward the total or consecutive failures. If your function is retried the maximum times and does not succeed, then that counts as one failure.

You can also choose to retry a single type of exception

Or multiple types of exceptions

Or pass through your own method:

Accessing the result

Flaky will return a Result class for your use.

Flaky Commands

If you have entire commands that are Flaky, you can use the FlakyCommand class as a convenience.

This command will now have Flaky protections, but only when invoked by the scheduler. If you run this command manually, Flaky is not engaged and you'll get all the exceptions as you would have otherwise.

Flaky Command IDs

The FlakyCommand::make($this) call will set the unique Flaky ID for you, based on the command's signature. By default, every invocation of an command is treated under the same key. If you want to vary that based on user input, you can use the varyOnInput method.

If you want to vary on particular input instead of all the input, you can pass an array of keys. This is useful for when each --arg should have its own flaky protections, but varying the --flag shouldn't create a unique set of protections.


All versions of flaky with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/support Version ^8.0|^9.0|^10
illuminate/cache Version ^8.0|^9.0|^10
illuminate/console Version ^8.0|^9.0|^10
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 hammerstone/flaky contains the following files

Loading the files please wait ....