Download the PHP package mattyeend/prevent-destructive-commands without Composer

On this page you can find all versions of the php package mattyeend/prevent-destructive-commands. 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 prevent-destructive-commands

Prevent Destructive Commands

Prevent Destructive Commands is a Laravel package that disables certain destructive Artisan commands in production environments to protect your database and application data.


Features

This package disables the following commands when the application is in the production environment:


Installation

  1. Install via Composer: composer require MattYeend/prevent-destructive-commands

Compatibility

This package is compatible with Laravel 9, 10, and 11.


Registration

Laravel 9 and 10

For Laravel 9 and 10, the service provider is automatically registered via Laravel's package discovery. No additional steps are required.

Laravel 11

Laravel 11 introduces stricter service provider registration. You need to manually register the service provider in the config/app.php file:

  1. Open the config/app.php file.
  2. Add the service provider to the providers array:

Usage

The package automatically disables destructive commands in the production environment. No additional setup is required.


Running a Disabled Command in Production

If you attempt to run any of the disabled commands in a production environment, you’ll receive an error message like: This 'migrate:fresh' command is disabled in this environment for safety. In non-production environments (e.g., local, staging), the commands will execute normally.


Environment Configuration

Ensure your .env file correctly specifies the application environment: APP_ENV=production The package determines the current environment using Laravel’s app()->environment() method.

Testing

You can simulate the package behavior by temporarily setting your application environment to production. To do this:

  1. Edit .env

  2. Attempt to run a destructive command, e.g.:

  3. You should see an error message similar to the following:
Testing through package
  1. Install dependencies

  2. Run the test

License

This package is licensed under the MIT License.


Contributing

Feel free to fork the repository and submit pull requests for improvements or new features!


All versions of prevent-destructive-commands with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
laravel/framework Version ^9.0 | ^10.0 | ^11.0
illuminate/support Version ^9.0 | ^10.0 | ^11.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 mattyeend/prevent-destructive-commands contains the following files

Loading the files please wait ....