Download the PHP package beryllium/kaboom without Composer

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

Kaboom

Author: Kevin Boyd (https://whateverthing.com)

Contributors:

License: MIT

What Is Kaboom?

Kaboom helps you deal with the realities of coding in long-term projects.

It provides an interface for adding temporary code to projects, code that needs to either start or stop running after a predetermined date on the calendar, or safety protections based on environment conditions.

... okay then, WHY Is Kaboom?

In my career, I've encountered a number of scenarios that Kaboom can help with, but the main one always seems to be forgetfulness. Organizations often don't take the time to circle back and clean things up, unless it is specifically called out in some way. It's often left up to individuals to remember to return to some arbitrary old project and spruce it up.

By adding Kaboom-backed tripwires to your project, you can schedule future reminders that are emitted by the code itself - directly into your logging and reporting systems!

You can also customize the tripwire behaviour. Maybe instead of logging after a set calendar date, you would prefer to detect an environment condition and throw an exception. This was the original use case for Kaboom, inspired by a joke on an ancient social media website called 'Twitter' from developer Jeremy Kendall.

"Here's a useful library: One that detects whether or not you're in a dev environment and explodes if error reporting isn't -1 :-)"

https://twitter.com/JeremyKendall/status/420672420253822976


After a while, another idea arose:

"Here's a fun idea: Temporal Todos ..."

https://twitter.com/Beryllium9/status/1314780273398013952

A code comment declares an urgent TODO task. Subsequently, an if statement uses the current unix timestamp (as of when it was coded) plus 1 day (in seconds) to detect if a RuntimeException should be thrown to enforce the TODO.


And then I thought, why not fold that functionality into Kaboom, and use it to help codebases fight back against cruft?

How to use Kaboom

Kaboom's default behaviour is to throw a KaboomException if conditions are met.

This is because the ExceptionHandler class is used in the default constructor.

ExceptionHandler - Example 1:

Here, we set a message that will "go kaboom" starting on Oct 20, 2020.

ExceptionHandler - Example 2:

Alternatively, we can harken back to the original Kaboom inspiration and "go kaboom" if error reporting is insufficient for our environment.

Configuring a Custom Kaboom Handler

Kaboom supports various Handlers that control how it behaves when a condition is tripped.

LoggingHandler

LoggingHandler - Example 3:

To configure Kaboom to log instead of throwing an exception, do this:

This can get a little lengthy, which is where a Dependency Injection Container would help.

For example, you could configure LoggingHandler to be the default implementation of HandlerInterface, which would then allow autowiring to wire things together so all you would have to request is $container->get(Beryllium\Kaboom\Kaboom::class).

NOTE: The second parameter of LoggingHandler, the Log Level, is optional. The default log level is WARNING.

Null Handler

NullHandler - Example 4:

You may want to have different configurations for different environments, such as not wanting to blow up on Production.

In that case, you can use the Null handler:

Grouped

Perhaps you want to have multiple handlers, such as if you've written a custom Slack handler (please contribute it back if so!! thanks!!). That's where the GroupHandler comes in.

GroupHandler - Example 5:

Now, Kaboom will loop through your provided handlers and log the message and then send it to Slack (in that order).

... But Why?

You might look at the implementation and think, well, this is just an if condition. And yeah, you're right - but it's a tiny bit more than that.

Kaboom establishes intentionality. When you use it to wrap something, you're making a statement. You're saying that this if condition is special.

Maybe you're saying that the code is temporary and can be deleted at some point.

Maybe you're saying that it's an important safety protection, but you want to be able to easily control Production vs Development behaviour to minimize user impact.

Maybe you just want to have some deeper insight into a particular type of if condition that is peppered throughout your codebase.

Regardless, this libary is here for your needs - whether you want a helpful log entry, or you're just looking for an earth-shattering Kaboom.

Contributions Welcome

If you have ideas for making Kaboom more widely useful, please add Issues or PRs.

Have you found Kaboom to be useful in your projects? Let me know on Mastodon!

@[email protected]

Thanks!


All versions of kaboom with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
psr/log Version ^1.1
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 beryllium/kaboom contains the following files

Loading the files please wait ....