Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Psl Laravel Package

azjezz/psl

PSL is a modern, well-typed standard library for PHP 8.4+, inspired by HHVM’s HSL. It offers safer, predictable APIs for async, collections, networking, I/O, crypto, terminal UI, and robust data validation—replacing brittle built-ins with consistent alternatives.

View on GitHub
Deep Wiki
Context7

DateTime

The DateTime component provides immutable, timezone-aware date and time types. It replaces PHP's mutable DateTime class with a design where every operation returns a new instance, eliminating an entire class of mutation bugs.

The component is built around several core types: DateTime for calendar-aware dates, Timestamp for raw points in time, Duration for exact time spans, Period for calendar-based periods, and Interval for time ranges.

Creating Dates

@example('system/datetime-creation.php')

Timestamps

A Timestamp represents a precise point in time as seconds and nanoseconds since the Unix epoch, independent of any timezone:

@example('system/datetime-timestamp.php')

Use Timestamp::monotonic() for duration measurements -- it uses a monotonic clock unaffected by system time adjustments.

Duration and Arithmetic

Duration represents an exact time span (hours, minutes, seconds, nanoseconds). All values are normalized automatically:

@example('system/datetime-duration.php')

Period

Period represents a calendar-based period (years, months, days). Unlike Duration, a period's actual time length depends on context - a month can be 28-31 days, and a day can be 23-25 hours due to DST. Months automatically normalize into years, but days are never normalized:

@example('system/datetime-period.php')

Interval

Interval represents a range between two points in time. It can check containment, overlap, and compute the exact duration between its endpoints:

@example('system/datetime-interval.php')

Convenience Methods

DateTime provides convenience methods for common boundary operations:

@example('system/datetime-convenience.php')

Comparing and Inspecting

@example('system/datetime-comparing.php')

Formatting and Parsing

@example('system/datetime-formatting.php')

Timezone Conversion

@example('system/datetime-timezone.php')

Interoperability

DateTime converts to and from PHP's DateTimeImmutable and ICU's IntlCalendar:

@example('system/datetime-interop.php')

See src/Psl/DateTime/ for the full API.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4