Download the PHP package maize-tech/laravel-model-expires without Composer

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

# Laravel Model Expires [![Latest Version on Packagist](https://img.shields.io/packagist/v/maize-tech/laravel-model-expires.svg?style=flat-square)](https://packagist.org/packages/maize-tech/laravel-model-expires) [![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/maize-tech/laravel-model-expires/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/maize-tech/laravel-model-expires/actions?query=workflow%3Arun-tests+branch%3Amain) [![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/maize-tech/laravel-model-expires/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/maize-tech/laravel-model-expires/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain) [![Total Downloads](https://img.shields.io/packagist/dt/maize-tech/laravel-model-expires.svg?style=flat-square)](https://packagist.org/packages/maize-tech/laravel-model-expires) With this package you can add expiration date to any model and exclude expired models from queries. When needed, you could send a notification for expiring models. You can also set a deletion date for every model and automatically clean them up with a command. ## Installation You can install the package via composer: You can publish the config and migration files and run the migrations with: This is the contents of the published config file: ## Usage ### Basic To use the package, add the `Maize\ModelExpires\HasExpiration` trait to all models you want to have an expiration date: That's it! All you have to do from now on is calling the `setExpiresAt` method every time you want to set an expiration and/or deletion date: ### Checking expiration and deletion days left You can also check whether a model is expired and calculate the amount of days before its expiration (or deletion): ### Excluding expired models When you want to exclude expired models, all you have to do is use the `withoutExpired` scope method: ### Retrieving only expired models When you want to retrieve expired models, all you have to do is use the `onlyExpired` scope method: ### Default expiration date If you wish, you can define a default expiration date. This can be done in two ways. First, you can set a value for `expires_after_days` property under `config/model-expires.php` config file. When set, all models including the `Maize\ModelExpires\HasExpiration` trait will automatically have an expiration date upon its creation: The second way is overriding the `defaultExpiresAt` method within all models you want to have a default expiration date: ### Default deletion date If you wish, you can define a default deletion date. This can be done in two ways. First, you can set a value for `deletes_after_days` property under `config/model-expires.php` config file. When set, all models including the `Maize\ModelExpires\HasExpiration` trait will automatically have a deletion date upon its creation: The second way is overriding the `defaultDeletesAt` method within all models you want to have a default deletion date: ### Scheduling expiration check The package comes with the `expires:check` command, which automatically fires a `ModelExpiring` event for all expiring models. To do so, you should define how often you want to fire the event. All you have to do is overriding the `fireExpiringEventBeforeDays` for all models using the `HasExpiration` trait: By default, the method returns an empty array, meaning models will never fire expiring events. Once done, you can schedule the command on a daily basis using the `schedule` method of the console kernel (usually located under the `App\Console` directory): ### Scheduling models deletion The package also comes with the `expires:delete` command, which automatically deletes all expired and deletable models. This comes pretty useful when automatizing its execution 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): ## 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 - [Enrico De Lazzari](https://github.com/enricodelazzari) - [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-model-expires with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/console Version ^10.0|^11.0
illuminate/database Version ^10.0|^11.0
illuminate/notifications Version ^10.0|^11.0
illuminate/support Version ^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-model-expires contains the following files

Loading the files please wait ....