Download the PHP package gtmassey/quarter without Composer

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

Quarter

Latest Version on Packagist Total Downloads Tests

Retrieve start and end dates for calendar or fiscal quarters for any year with ease!

Installation

You can install the package via composer:

This package is an extension of the gtmassey/period package. You can find the documentation for that package here.

Usage

The package provides a Quarter class which contains static methods for each quarter of a year, and additional methods that can be chained on that allow for mutations of the quarter to specific years, calendar types, and dates.

As an extension of the Period class from gtmassey/period, the resulting Quarter object is structured the same way:

Specifying Years

If you want to specify the year of the quarter, you can chain the year() method on the quarter. Note that you have to format the year as YYYY. If you don't, it will take the year literally, i.e. the year 0020.

Changing the Resulting Object

By default, the Quarter class returns a Quarter object. You can default to the parent Period object by calling the asPeriod() method:

which will result in an instance of Period like so:

Changing Calendar Types

So far, the quarter methods have been assuming a calendar year for the quarter dates. If you want to use the fiscal year in which the first quarter starts on July 1, you can chain the toFiscal() method:

You can chain the year() and toFiscal() methods together:

and if you want the resulting object to be an instance of the parent Period class, you can chain the asPeriod() method:

The toFiscal() method creates a new Quarter instance that is 6 months ahead of the current Quarter.

If you wish to convert the current Quarter instance into a fiscal representation, you can use the asFiscal() method.

The difference between toFiscal() and asFiscal() is that the asFiscal() keeps the start and end dates the same, it just changes the instance's name to be the correct representation in a fiscal calendar.

Using the asFiscal() method preserves the start and end dates of the quarter, but changes the name and isFiscal properties on the object.

Start and End Dates Only

Sometimes you only need to access the start and end dates of a given quarter, without accessing the entire range. To do that, simply add the startDate() or endDate() method to the chain:

Past and Future Quarters:

If you have a given quarter object, and you want to get the next quarter, you can use the next() method:

To get the previous quarters from a given Quarter object, use the previous() method:

Finally, you can access the current quarter by calling the current() method:

Laravel Note:

The parent Period class is written specifically for Laravel because it is an extracted package from the gtmassey/laravel-analytics package. However, the Quarter class does not need Laravel to function. If you want to use the Quarter class in Laravel, you can add the class to your config/app.php aliases array:

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

To contribute, fork the repo, create a new branch, and submit a pull request. I will do my best to review them in a timely manner.

License

The MIT License (MIT). Please see License File for more information.


All versions of quarter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1||^8.2
nesbot/carbon Version ^2.64
gtmassey/period Version ^1.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 gtmassey/quarter contains the following files

Loading the files please wait ....