azjezz/psl

PHP Standard Library

Maintainers

Details

github.com/azjezz/psl

Source

Issues

Fund package maintenance!
Open Collective

Installs: 790 758

Dependents: 38

Suggesters: 0

Security: 0

Stars: 955

Watchers: 21

Forks: 56

Open Issues: 19

2.3.0 2022-12-01 07:52 UTC

README

Open Collective Unit tests status Static analysis status Security analysis status Coding standards status Coding standards status CII Best Practices Coverage Status MSI 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\Async;
use Psl\TCP;
use Psl\IO;
use Psl\Shell;
use Psl\Str;

Async\main(static function(): int {
    IO\write_line('Hello, World!');

    [$version, $connection] = Async\concurrently([
        static fn() => Shell\execute('php', ['-v']),
        static fn() => TCP\connect('localhost', 1337),
    ]);

    $messages = Str\split($version, "\n");
    foreach($messages as $message) {
        $connection->writeAll($message);
    }

    $connection->close();

    return 0;
});

Installation

Supported installation method is via composer:

composer require azjezz/psl

Psalm Integration

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

PHPStan Integration

Please refer to the php-standard-library/phpstan-extension 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
68747470733a2f2f7265732e636c6f7564696e6172792e636f6d2f617a6a657a7a2f696d6167652f75706c6f61642f76313539393233393931302f6a6574627261696e735f716e7962306f2e706e67

License

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