Download the PHP package yarob/laravel-expirable without Composer

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

Laravel Expirable

Add expiring feature to Eloquent models in Laravel 5.

Background

This has been developed to simplify adding expirable feature to any eloquent model on your laravel project.

Installation

To install the package via Composer:

Then, update config/app.php by adding an entry for the service provider.

Finally, via terminal, publish the default configuration file (if you need to, see below):

Updating your Eloquent Models

Your models can now use the Expirable trait. You must also add expire_at to your $dates array in the model as shown in the example below

Migration

Your model MUST have column named expire_at in the database to store the expiry date value. You can add this manually via a migration on the intended model $table->timestamp('expire_at')->nullable();.

Usage

There are three basic functions in Expirable trait:

Querying Expirable Models

Expired models (passed it’s expiry date) will automatically be excluded from query results. For example:-

will only gets models that has NOT expired or has null expiry date. Any expired models WILL be auto-excluded.

Including expired Models

You can force expired models to appear in query results using withHasExpiry

Retrieving Only Expired Models

The onlyHasExpiry method can be used on a relationship query:

This will exclude ONLY null expiry date from results. Please note this will get ALL models that have non null expiry date, regradless of their expiry date.

Retrieving Models has null expiry

The withoutHasExpiry method can be used in this case:

This will bring models that has null expiry date.

Configuration

Configuration is not usually needed, unless you want to set a default revival time to a model(s). A default value of 86400 seconds is set for user model, as an example, but feel free to change that to any value you want. Here is an example configuration:

Pay attention that Model name in expirable.php is case sensitive! so if you have a foo Model, then

Copyright and License

laravel-expirable was written by Yarob Al-Taay and is released under the MIT License.

Copyright (c) 2017 Yarob Al-Taay


All versions of laravel-expirable with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.4
nesbot/carbon Version 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 yarob/laravel-expirable contains the following files

Loading the files please wait ....