Go to file
2021-04-07 09:13:18 +01:00
.github [ga]: Bump actions/cache from v2 to v2.1.4 2021-03-28 09:44:39 +01:00
docs [Type] add positive-int type (#177) 2021-04-07 09:13:18 +01:00
integration/Psalm recommand using the psalm-plugin package over builtin integration (#170) 2021-03-27 20:10:18 +01:00
src [Type] add positive-int type (#177) 2021-04-07 09:13:18 +01:00
tests [Type] add positive-int type (#177) 2021-04-07 09:13:18 +01:00
tools move tools to a sub directory 2021-03-28 09:29:08 +01:00
.editorconfig move tools to a sub directory 2021-03-28 09:29:08 +01:00
.gitattributes move tools to a sub directory 2021-03-28 09:29:08 +01:00
.gitignore move tools to a sub directory 2021-03-28 09:29:08 +01:00
CODE_OF_CONDUCT.md add contributors guidlines 2021-03-28 09:29:08 +01:00
composer.json move tools to a sub directory 2021-03-28 09:29:08 +01:00
CONTRIBUTING.md add contributors guidlines 2021-03-28 09:29:08 +01:00
LICENSE Initial commit 2019-12-24 02:01:46 +01:00
Makefile fix basepath for php-codesniffer 2021-03-28 10:36:35 +01:00
README.md add contributors guidlines 2021-03-28 09:29:08 +01:00
SECURITY.md add contributors guidlines 2021-03-28 09:29:08 +01:00

Psl - PHP Standard Library

Unit tests status Static analysis status Security analysis status Coding standards status Coding standards status Coverage Status Type Coverage Total Downloads Latest Stable Version License

Psl is a standard library for PHP, inspired by hhvm/hsl.

The goal of Psl is to provide a consistent, centralized, well-typed set of APIs for PHP programmers.

Example

<?php

declare(strict_types=1);

use Psl\{Str, Vec};

/**
 * @psalm-param iterable<?int> $codes
 */
function foo(iterable $codes): string
{
    $codes = Vec\filter_nulls($codes);

    $chars = Vec\map($codes, fn(int $code): string => Str\chr($code));

    return Str\join($chars, ', ');
}

foo([95, 96, null, 98]);
// 'a, b, d'

Installation

Supported installation method is via composer:

composer require azjezz/psl

Psalm Integration

Please refer to the php-standard-library/psalm-plugin repository.

Documentation

You can read through the API documentation in docs/ directory.

Interested in contributing?

Have a look at CONTRIBUTING.md.

Sponsors

Thanks to our sponsors and supporters:

JetBrains

License

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