Download the PHP package maize-tech/laravel-prunable-fields without Composer

On this page you can find all versions of the php package maize-tech/laravel-prunable-fields. 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-prunable-fields

Laravel Prunable Fields

[![Latest Version on Packagist](https://img.shields.io/packagist/v/maize-tech/laravel-prunable-fields.svg?style=flat-square)](https://packagist.org/packages/maize-tech/laravel-prunable-fields) [![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/maize-tech/laravel-prunable-fields/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/maize-tech/laravel-prunable-fields/actions?query=workflow%3Arun-tests+branch%3Amain) [![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/maize-tech/laravel-prunable-fields/php-cs-fixer.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/maize-tech/laravel-prunable-fields/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain) [![Total Downloads](https://img.shields.io/packagist/dt/maize-tech/laravel-prunable-fields.svg?style=flat-square)](https://packagist.org/packages/maize-tech/laravel-prunable-fields) This package allows you to clean model fields with an easy command. The feature is highly inspired by Laravel's Prunable core feature, and allows you to easily adapt all your existing models. ## Installation You can install the package via composer: You can publish the config file with: This is the contents of the published config file: ## Usage ### Prunable models To use the package, simply add the `Maize\PrunableFields\PrunableFields` trait to all models you want to clean. Once done, you can define the list of attributes who should be cleaned up by implementing the `$prunable` class property. The array key should be the attribute name, whereas the array value should be the value you want the attribute to be updated to. After that, implement the `prunableFields` method which should return an Eloquent query builder that resolves the models that should be cleaned up. If needed, you can also override the `pruningFields` and `prunedFields` methods (which are empty by default) to execute some actions before and after the model is being updated. Here's an example model including the `PrunableFields` trait: All you have to do now is including the model's class name in `models` attribute under `config/prunable-fields.php`: That's it! From now on, the `model:prune-fields` command will do all the magic. In our example, all users created before the current day will be updated with a null value for both `first_name` and `last_name` attributes. ### Mass prunable models When using the `MassPrunableFields` trait all models will be updated with a raw database query. In this case, `pruningFields` and `prunedFields` methods will not be invoked, and models will not fire the `updating` or `updated` events. This way there is no need to retrieve all models before updating them, making the command execution way faster when working with a large number of entries. ### Scheduling models cleanup The package is pretty useful when you automatize the execution of the `model:prune-fields` command, using Laravel's scheduling. All you have to do is add the following instruction to the `schedule` method of the console kernel (usually located under the `App\Console` directory): By default, when executing the `model:prune-fields` command the package will take all prunable models specified in `models` attribute under `config/prunable-fields.php`. If you want to restrict the model list you want to automatically clean up, you can pass the `--model` option to the command: Alternatively, you can clean up all models listed in your config and exclude some of them with the `--execpt` command option: ## Testing ## Changelog Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. ## Contributing Please see [CONTRIBUTING](https://github.com/maize-tech/.github/blob/main/CONTRIBUTING.md) for details. ## Security Vulnerabilities Please review [our security policy](https://github.com/maize-tech/.github/security/policy) on how to report security vulnerabilities. ## Credits - [Riccardo Dalla Via](https://github.com/riccardodallavia) - [All Contributors](../../contributors) ## License The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

All versions of laravel-prunable-fields with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/console Version ^9.0|^10.0|^11.0
illuminate/database Version ^9.0|^10.0|^11.0
illuminate/events Version ^9.0|^10.0|^11.0
illuminate/support Version ^9.0|^10.0|^11.0
spatie/laravel-package-tools Version ^1.14.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 maize-tech/laravel-prunable-fields contains the following files

Loading the files please wait ....