katesune 6d6efdabaa commit 4 gadi atpakaļ
..
src 6d6efdabaa commit 4 gadi atpakaļ
CHANGELOG.md 6d6efdabaa commit 4 gadi atpakaļ
LICENSE 6d6efdabaa commit 4 gadi atpakaļ
README.md 6d6efdabaa commit 4 gadi atpakaļ
composer.json 6d6efdabaa commit 4 gadi atpakaļ

README.md

ramsey/collection

Source Code Latest Version Software License PHP Version Build Status Coverage Status Total Downloads

ramsey/collection is a PHP 7.2+ library for representing and manipulating collections.

Much inspiration for this library came from the Java Collections Framework.

This project adheres to a code of conduct. By participating in this project and its community, you are expected to uphold this code.

Installation

Install this package as a dependency using Composer.

composer require ramsey/collection

Usage

The latest class API documentation is available online.

Examples of how to use this framework can be found in the Wiki pages.

Contributing

Contributions are welcome! Before contributing to this project, familiarize yourself with CONTRIBUTING.md.

To develop this project, you will need PHP 7.2 or greater and Composer.

After cloning this repository locally, execute the following commands:

cd /path/to/repository
composer install

Now, you are ready to develop!

Tooling

This project uses CaptainHook to validate all staged changes prior to commit.

Composer Commands

To see all the commands available in the project br namespace for Composer, type:

composer list br
Composer Command Autocompletion

If you'd like to have Composer command auto-completion, you may use bamarni/symfony-console-autocomplete. Install it globally with Composer:

composer global require bamarni/symfony-console-autocomplete

Then, in your shell configuration file — usually ~/.bash_profile or ~/.zshrc, but it could be different depending on your settings — ensure that your global Composer bin directory is in your PATH, and evaluate the symfony-autocomplete command. This will look like this:

export PATH="$(composer config home)/vendor/bin:$PATH"
eval "$(symfony-autocomplete)"

Now, you can use the tab key to auto-complete Composer commands:

composer br:[TAB][TAB]

Coding Standards

This project follows a superset of PSR-12 coding standards, enforced by PHP_CodeSniffer. The project PHP_CodeSniffer configuration may be found in phpcs.xml.dist.

CaptainHook will run PHP_CodeSniffer before committing. It will attempt to fix any errors it can, and it will reject the commit if there are any un-fixable issues. Many issues can be fixed automatically and will be done so pre-commit.

You may lint the entire codebase using PHP_CodeSniffer with the following commands:

# Lint
composer br:lint

# Lint and autofix
composer br:lint:fix

Static Analysis

This project uses a combination of PHPStan and Psalm to provide static analysis of PHP code. Configurations for these are in phpstan.neon.dist and psalm.xml, respectively.

CaptainHook will run PHPStan and Psalm before committing. The pre-commit hook does not attempt to fix any static analysis errors. Instead, the commit will fail, and you must fix the errors manually.

You may run static analysis manually across the whole codebase with the following command:

# Static analysis
composer br:analyze

Project Structure

This project uses pds/skeleton as its base folder structure and layout.

Name Description
bin/ Commands and scripts for this project
build/ Cache, logs, reports, etc. for project builds
docs/ Project-specific documentation
resources/ Additional resources for this project
src/ Project library and application source code
tests/ Tests for this project

Copyright and License

The ramsey/collection library is copyright © Ben Ramsey and licensed for use under the terms of the MIT License (MIT). Please see LICENSE for more information.