diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..4dd55cb --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +# EditorConfig helps maintain consistent coding styles for developers working on the same project across various editors and IDEs. +# See https://editorconfig.org. + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.php] +indent_size = 4 + +[*.xml] +indent_size = 4 diff --git a/.github/workflows/composer.yml b/.github/workflows/composer.yml deleted file mode 100644 index 0051ebf..0000000 --- a/.github/workflows/composer.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Composer Validation - -on: - pull_request: - -jobs: - validate: - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - php: [8.1] - steps: - - name: Cancel previous runs of this workflow (pull requests only) - if: ${{ github.event_name == 'pull_request' }} - uses: styfle/cancel-workflow-action@0.5.0 - with: - access_token: ${{ github.token }} - - - name: Check out code - uses: actions/checkout@v3 - - - name: Set up PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - tools: composer:v2 - coverage: none - - - name: Run Composer config validation - run: composer validate --strict diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml index cee15a2..a9b51ac 100644 --- a/.github/workflows/cs.yml +++ b/.github/workflows/cs.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: true matrix: - php: [8.1] + php: [ 8.1 ] steps: - name: Cancel previous runs of this workflow (pull requests only) if: ${{ github.event_name == 'pull_request' }} @@ -24,15 +24,9 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - tools: composer:v2 - coverage: none - name: Install composer dependencies - uses: nick-invision/retry@v1 - with: - timeout_minutes: 5 - max_attempts: 5 - command: composer install + uses: ramsey/composer-install@v2 - name: Run PHPCS run: composer run-script phpcs diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c54518c..c9a82eb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,9 +9,8 @@ jobs: strategy: fail-fast: true matrix: - php: [8.1, 8.0, 7.4] - can_fail: [false] - + php: [ 8.1, 8.0, 7.4 ] + can_fail: [ false ] name: PHP ${{ matrix.php }} steps: - name: Check out code @@ -21,15 +20,9 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - tools: composer:v2 - coverage: none - - name: Install Composer dependencies - uses: nick-invision/retry@v2 - with: - timeout_minutes: 5 - max_attempts: 5 - command: composer install + - name: Install composer dependencies + uses: ramsey/composer-install@v2 - name: Run PHPUnit shell: bash diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d0e95a..8273f70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ This library adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/en/1.0.0/). +## Unreleased + +Nothing yet. + ## 1.1.0 ### Added @@ -10,7 +14,7 @@ This library adheres to [Semantic Versioning](https://semver.org/) and [Keep a C ### Fixed -- Incorrect value being passed to `BaseValidator::testValue()` in `BaseValidator::isValid()`. +- Incorrect value being passed to `BaseValidator::testValue()` in `BaseValidator::isValid()`. ## 1.0.0 diff --git a/README.md b/README.md index 58750fe..90a599b 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,19 @@ This package provides additional validation classes for [the Laminas Validator framework](https://docs.laminas.dev/laminas-validator/), plus a custom base validation class. -For more information about what validators do, how to use them, and how to write your own, [visit the Laminas documentation](https://docs.laminas.dev/laminas-validator/). +## Installation -## Base Validator +Install the latest version with: + +```bash +$ composer require alleyinteractive/laminas-validator-extensions +``` + +## Basic usage + +For more information about what validators do, how to use them, and how to write your own, [visit the Laminas documentation](https://docs.laminas.dev/laminas-validator/). + +## Base validator The abstract `Alley\Validator\BaseValidator` class standardizes the implementation of custom validators with `\Laminas\Validator\AbstractValidator`. @@ -59,7 +69,7 @@ class Float extends \Alley\Validator\BaseValidator } ``` -## "Any Validator" Chains +## "Any Validator" chains `\Alley\Validator\AnyValidator` is like a [validator chain](https://docs.laminas.dev/laminas-validator/validator-chains/) except that it connects the validators with "OR," marking input as valid as soon it passes one of the given validators. @@ -195,3 +205,13 @@ $valid->isValid('date_create_immutable'); // true $valid = new \Alley\Validator\Type(['type' => 'bool']); $valid->isValid([]); // false ``` + +## About + +### License + +[GPL-2.0-or-later](https://github.com/alleyinteractive/laminas-validator-extensions/blob/main/LICENSE) + +### Maintainers + +[Alley Interactive](https://github.com/alleyinteractive) diff --git a/composer.json b/composer.json index bf77af7..a9d103a 100644 --- a/composer.json +++ b/composer.json @@ -1,41 +1,40 @@ { - "name": "alleyinteractive/laminas-validator-extensions", - "description": "Additional validation classes for the laminas-validator framework.", - "type": "library", - "license": "GPL-2.0-or-later", - "authors": [ - { - "name": "Alley", - "email": "info@alley.co" - } - ], - "autoload": { - "psr-4": { - "Alley\\": "src/Alley/" - } - }, - "autoload-dev": { - "psr-4": { - "Alley\\": "tests/Alley/" - } - }, - "config": { - "optimize-autoloader": true, - "classmap-authoritative": true - }, - "require": { - "php": "^7.4 || ^8.0", - "laminas/laminas-validator": "^2.20" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.8", - "phpunit/phpunit": "^9.5", - "squizlabs/php_codesniffer": "^3.6" - }, - "scripts": { - "fixer": "php-cs-fixer -v fix --allow-risky=yes", - "phpcbf": "phpcbf", - "phpcs": "phpcs", - "phpunit": "phpunit" + "name": "alleyinteractive/laminas-validator-extensions", + "description": "Additional validation classes for the laminas-validator framework.", + "type": "library", + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Alley", + "email": "info@alley.co" } + ], + "autoload": { + "psr-4": { + "Alley\\": "src/Alley/" + } + }, + "autoload-dev": { + "psr-4": { + "Alley\\": "tests/Alley/" + } + }, + "config": { + "lock": false + }, + "require": { + "php": "^7.4 || ^8.0", + "laminas/laminas-validator": "^2.20" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.8", + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "^3.6" + }, + "scripts": { + "fixer": "php-cs-fixer -v fix --allow-risky=yes", + "phpcbf": "phpcbf", + "phpcs": "phpcs", + "phpunit": "phpunit" + } } diff --git a/phpcs.xml b/phpcs.xml index 0e7fee8..f36b9e6 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -1,6 +1,6 @@ - - The coding standard for laminas-validator-extensions. + + The coding standard for alleyinteractive/laminas-validator-extensions. src/ tests/