PHPackages                             sammycorgi/laravel-collection-time-filter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. sammycorgi/laravel-collection-time-filter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sammycorgi/laravel-collection-time-filter
=========================================

Filters laravel collections with a set interval to a different interval

037PHPCI failing

Since Jan 18Pushed 5y ago1 watchersCompare

[ Source](https://github.com/sammycorgi/laravel-collection-time-filter)[ Packagist](https://packagist.org/packages/sammycorgi/laravel-collection-time-filter)[ RSS](/packages/sammycorgi-laravel-collection-time-filter/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

laravel-collection-time-filter
==============================

[](#laravel-collection-time-filter)

Filters laravel collections with time to have a certain interval

Currently can filter down a collection from 24 hours worth of points to any required interval in minutes of 12 hours or less, as long as the interval is a divisor of 24 hours.

Installation
============

[](#installation)

`composer require sammycorgi/laravel-collection-time-filter`

Usage
=====

[](#usage)

Pass a collection of `LaravelCollectionTimeFilter\HasTime` objects to a new instance of a `LaravelCollectionTimeFilter\CollectionTimeFilterMinutes`, along with the required interval in minutes and the existing interval. The existing interval isn't too important it just ensures that the required interval is larger.

Please note, the input collection **must** be sorted by time ascending.

Call `getFilteredCollection()` on this object to filter down the results to the required interval.

This will find the closest value to the given interval, starting at 00:00 and ending at 00:00 the following day minus your required interval, for a total of `24 * intervalsPerHour` intervals.

Return Type
-----------

[](#return-type)

By default, the returned collection type will be the same as the one that the filter was instantiated with. To change this behaviour, simply extend the class and amend the `getNewCollection()` method.

'Null' values
-------------

[](#null-values)

If the filter cannot find a suitable time for a given interval, it will by default insert a null value into the returned array.

This can be changed to insert the interval time at this point by passing `true` as the final argument in the constructor.

By default, this will be an instance of a `LaravelCollectionTimeFilter\DateWrapper` object. Extend the class and amend the `getWriteNullValuesObject()` method to change this behaviour. It must still return a class that implements the `LaravelCollectionTimeFilter\Contracts\HasTime` interface.

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/35593534?v=4)[Sam Driver](/maintainers/sammycorgi)[@sammycorgi](https://github.com/sammycorgi)

---

Top Contributors

[![sammycorgi](https://avatars.githubusercontent.com/u/35593534?v=4)](https://github.com/sammycorgi "sammycorgi (13 commits)")

### Embed Badge

![Health badge](/badges/sammycorgi-laravel-collection-time-filter/health.svg)

```
[![Health](https://phpackages.com/badges/sammycorgi-laravel-collection-time-filter/health.svg)](https://phpackages.com/packages/sammycorgi-laravel-collection-time-filter)
```

###  Alternatives

[96qbhy/baidu-aip

百度 AI 开放平台 php-sdk

594.2k](/packages/96qbhy-baidu-aip)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
