Search by

a-mazalov / kali-tools

a-mazalov

Utilities for a Laravel Project

Package info

github.com/a-mazalov/kali-tools

pkg:composer/a-mazalov/kali-tools

Fund package maintenance!

a-mazalov

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2026-10-14 12:07 UTC

This package is auto-updated.

Last update: 2026-10-14 12:07:51 UTC


README

Kali Tools

Packagist PHP from Packagist Laravel versions GitHub Workflow Status (main) Total Downloads

Utilities for a Laravel Project

Installation

You can install the package via Composer:

composer require a-mazalov/kali-tools

You may publish all of the package's resources at once:

php artisan vendor:publish --tag="kali-tools"

Or, you may publish each resource individually:

Publishing the Configuration File

php artisan vendor:publish --tag="kali-tools-config"

Publishing the Translations

php artisan vendor:publish --tag="kali-tools-lang"

Usage

Production Database Guard

Once installed, the package listens for Artisan commands that change the database (migrate, migrate:fresh, migrate:install, migrate:refresh, migrate:reset, migrate:rollback, db:seed, db:wipe). When the command's connection (the --database option or database.default) points to a production database, the package prints the connection, username, database name, and host, then asks for an additional confirmation. If the confirmation is declined, or the command runs non-interactively, the command is aborted with a non-zero exit code before it touches the database.

List production hosts and database names (Oracle service names and SIDs included) in your .env (comma-separated, case-insensitive):

KALI_TOOLS_PRODUCTION_DB_HOSTS=prod-db.example.com,10.0.0.5
KALI_TOOLS_PRODUCTION_DB_DATABASES=PRODSRV,PRODDB

A connection is considered production when any value of the fields checked for its driver matches. Fields are keys of the database.connections.* entry (so host is what DB_HOST fills in config/database.php, database is DB_DATABASE), and tns:KEY reads a value from an Oracle tns descriptor:

Driver Hosts (KALI_TOOLS_PRODUCTION_DB_HOSTS) Databases (KALI_TOOLS_PRODUCTION_DB_DATABASES)
mysql, mariadb, pgsql, sqlsrv, other drivers host, read.host, write.host database
oracle host, read.host, write.host, tns:HOST service_name, database, tns:SERVICE_NAME, tns:SID

To change these fields or add a driver, publish the configuration file and edit database_guard.fields. Drivers that are not listed use fields.default.

This works with Oracle connections configured for yajra/laravel-oci8 as well as MySQL, MariaDB, PostgreSQL, and SQL Server connections.

 WARN The [migrate] command is about to run against a PRODUCTION database.

 Connection ........................................... oracle
 Username ......................................... APP_OWNER
 Database ............................................ PRODSRV
 Host ................................... prod-db.example.com

 Are you sure you want to run this command on the production database? (yes/no) [no]:

Other options:

# Disable the guard entirely.
KALI_TOOLS_PRODUCTION_DB_GUARD=false

# Let `--force` skip the confirmation, e.g. in deployment pipelines.
KALI_TOOLS_PRODUCTION_DB_ALLOW_FORCE=true

To change the list of guarded commands, publish the configuration file and edit database_guard.commands. Messages are available in English and Russian and can be customized by publishing the translations.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Thank you for considering contributing to Kali Tools! Please review our contributing guide to get started.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

Kali Tools is open-sourced software licensed under the MIT license.