Download the PHP package greenimp/laravel-date-range without Composer

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

Laravel date range

Easy handling of Laravel models that have a start / end date, or a set of date ranges.

This package is built for Laravel 8-9.

Setup

Install

Set up the DB

If you want to use multiple date ranges on a single model, then you need to create the DB tables, unless you are using a custom model.

First, publish the migrations:

The run them:

Note If your config is cached, the migration will fail. You will need to clear the config cache before running the migration:

Configuring the package

Publishing the config file is optional:

Usage

Single date ranges

If your model only requires a single start / end date (e.g. a one off event), the model must implement the HasDateRange interface, and the InteractsWithDateRange trait.

The trait contains an abstract method getDateRangeOptions, which you must implement yourself.

Your models' migrations should have datetime fields to save the start / end dates to.

Here's an example of how to implement the trait:

An example migration for the model:

Multiple date ranges

If your model has multiple date ranges (e.g. A repeating event such as a national holiday), the model must implement the HasDateRanges interface, and the InteractsWithDateRanges trait.

The trait adds a new dates relationship, which links to the list of date ranges.

Note: Unless you're using a run the migration.

Customisation

Custom Date Range model

By default, the dates relationship on the InteractsWithDateRanges trait, for multiple date ranges, will use the DateRange model that comes with this package.

If you want to use your own custom class, you can use any model that implements the HasDateRange interface, and the InteractsWithDateRange trait.

To set up your custom model, follow the instructions for creating a single date range model.

You also need to update the config file, to use your custom class:

Database migration options

Table name

The migration file that comes with this package will create a table to store the DateRange models in, called date_ranges.

You can change the name of the table in the config file:

Table columns

You can also rename the table columns that will be used in the migration.

Note: This will also affect the default field names for the start / end dates of the DateRangeOptions class, used in the getDateRangeOptions method.


All versions of laravel-date-range with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0|8.1|8.2
illuminate/database Version ^8.0|^9.0
illuminate/support Version ^8.0|^9.0
nesbot/carbon Version ^2.65
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 greenimp/laravel-date-range contains the following files

Loading the files please wait ....