Download the PHP package spinen/laravel-garbage-man without Composer

On this page you can find all versions of the php package spinen/laravel-garbage-man. 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 laravel-garbage-man

SPINEN's Laravel Garbage Man

Latest Stable Version Latest Unstable Version Total Downloads License

The soft deletes are great in Laravel to make sure that some deleted data can be recovered. This package allows you to configure an array of models with how many days that you want the soft deleted data to stay in the database.

Build Status

Branch Status Coverage Code Quality
Develop Build Status Code Coverage Scrutinizer Code Quality
Master Build Status Code Coverage Scrutinizer Code Quality

Prerequisite

NOTE: If you need to use < PHP 7.2, please stay with version 1.x

As side from Laravel >= 5.1.10 (5.1.10 is the first version that had the warn method, so that is the minimum for logging), there is 1 package that is required.

Install

Install Garbage Man:

For >= Laravel 5.5, you are done with the installation

The package uses the auto registration feature of Laravel 5.

Upgrading to 2.x from 1.x

As of Laravel 5.8 (and deprecated in 5.4), the fire() method on the dispatcher contract was removed in favor of dispatch(). Therefore, we have updated our code to use dispatch(). You will need to change fire() to dispatch() in your config/garbageman.php file.

Using the command

The command is registered with laravel as . You can run it one of 2 ways...

  1. from the command line
  2. via a scheduled task.

To automatically run the script as a scheduled job, then add the following to the schedule method of App\Console\Kernel.php:

You can use whatever schedule that you need to keep the records purged out. Just review the list at http://laravel.com/docs/master/scheduling#schedule-frequency-options.

You can also use any of the advanced configuration options of the task scheduler like "Task Output" or "Task Hooks" as listed on the Laravel documentation.

Configuration

Publish the package config file to config/garbageman.php:

This file is fully documented. You will need to make the changes to that file to suit your needs. There are 3 main configuration items...

  1. Dispatch purge events - Dispatch events on purge of each record.
  2. Logging level - Level to log.
  3. Schedule - Models & number of days to allow the soft deleted record to stay before purging.

Dispatch purge events (dispatch_purge_events)

You may hook into the purge of each record by throwing events before & after deleting of each record. There are 2 events thrown:

The model is passed with each of the events. The "purging" event is thrown just before the actual delete & "purged" is thrown just after the actual deletion.

Please note: This is an expensive operation as it requires a SQL command for each record to delete so that the record can be thrown with the events. Therefore, unless you need to catch the events to perform some other action, leave this false to allow all records per model to get deleted with a single SQL call.

Logging level (logging_level)

The level that log messages are generated, which will display information on the console output and in the logs.

Level Description
0 Emergency: system is unusable
1 Alert: action must be taken immediately
2 Critical: critical conditions
3 Error: error conditions
4 Warning: warning conditions
5 Notice: normal but significant condition
6 (default) Info: informational messages
7 Debug: debug - level messages

There is a key for the console & one for the log. Here is an example...

Alternatively, you can set the levels with environmental variables and .

Schedule (schedule)

The age is in days for each model. Here is an example...

This would purge any ModelOnes that were deleted over 14 days ago and any ModelTwos that were deleted over 30 days ago.


All versions of laravel-garbage-man with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
illuminate/console Version ~9|~10
illuminate/database Version ~9|~10
illuminate/support Version ~9|~10
nesbot/carbon Version ^2.62.1
psr/log Version ^1.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 spinen/laravel-garbage-man contains the following files

Loading the files please wait ....