-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tom Wright <[email protected]>
- Loading branch information
1 parent
dd7f32c
commit c866c13
Showing
12 changed files
with
586 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# https://EditorConfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
block_comment_start = /* | ||
block_comment = * | ||
block_comment_end = */ | ||
|
||
[*.yml] | ||
indent_size = 2 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.editorconfig export-ignore | ||
.gitattributes export-ignore | ||
.github/ export-ignore | ||
.gitignore export-ignore | ||
CHANGELOG.md export-ignore | ||
ecs.php export-ignore | ||
phpstan.neon export-ignore | ||
phpunit.xml.dist export-ignore | ||
docs/ export-ignore | ||
tests/ export-ignore | ||
stubs/ export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow | ||
|
||
name: "Integrate" | ||
|
||
on: | ||
push: | ||
branches: | ||
- "develop" | ||
pull_request: null | ||
|
||
env: | ||
PHP_EXTENSIONS: "intl" | ||
|
||
jobs: | ||
file_consistency: | ||
name: "1️⃣ File consistency" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Set up PHP" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
php-version: "8.1" | ||
extensions: "${{ env.PHP_EXTENSIONS }}" | ||
ini-values: "post_max_size=256M" | ||
|
||
- name: "Checkout code" | ||
uses: "actions/checkout@v3" | ||
|
||
- name: Install Effigy | ||
run: | | ||
composer global config --no-plugins allow-plugins.phpstan/extension-installer true | ||
composer global require decodelabs/effigy | ||
- name: "Install dependencies" | ||
uses: "ramsey/composer-install@v2" | ||
with: | ||
dependency-versions: "highest" | ||
|
||
- name: "Check file permissions" | ||
run: | | ||
composer global exec effigy check-executable-permissions | ||
- name: "Check exported files" | ||
run: | | ||
composer global exec effigy check-git-exports | ||
- name: "Find non-printable ASCII characters" | ||
run: | | ||
composer global exec effigy check-non-ascii | ||
- name: "Check source code for syntax errors" | ||
run: | | ||
composer global exec effigy lint | ||
static_analysis: | ||
name: "3️⃣ Static Analysis" | ||
needs: | ||
- "file_consistency" | ||
runs-on: "ubuntu-latest" | ||
strategy: | ||
matrix: | ||
php-version: | ||
- "8.1" | ||
- "8.2" | ||
- "8.3" | ||
steps: | ||
- name: "Set up PHP" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
php-version: "${{ matrix.php-version }}" | ||
extensions: "${{ env.PHP_EXTENSIONS }}" | ||
ini-values: "post_max_size=256M" | ||
|
||
- name: "Checkout code" | ||
uses: "actions/checkout@v3" | ||
|
||
- name: Install Effigy | ||
run: | | ||
composer global config --no-plugins allow-plugins.phpstan/extension-installer true | ||
composer global require decodelabs/effigy | ||
- name: "Validate Composer configuration" | ||
run: "composer validate --strict" | ||
|
||
- name: "Install dependencies" | ||
uses: "ramsey/composer-install@v2" | ||
with: | ||
dependency-versions: "highest" | ||
|
||
- name: "Execute static analysis" | ||
run: | | ||
composer global exec effigy analyze -- --headless | ||
coding_standards: | ||
name: "4️⃣ Coding Standards" | ||
needs: | ||
- "file_consistency" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Set up PHP" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
php-version: "8.1" | ||
extensions: "${{ env.PHP_EXTENSIONS }}" | ||
ini-values: "post_max_size=256M" | ||
|
||
- name: "Checkout code" | ||
uses: "actions/checkout@v3" | ||
|
||
- name: "Check EditorConfig configuration" | ||
run: "test -f .editorconfig" | ||
|
||
- name: "Check adherence to EditorConfig" | ||
uses: "greut/eclint-action@v0" | ||
|
||
- name: Install Effigy | ||
run: | | ||
composer global config --no-plugins allow-plugins.phpstan/extension-installer true | ||
composer global require decodelabs/effigy | ||
- name: "Install dependencies" | ||
uses: "ramsey/composer-install@v2" | ||
with: | ||
dependency-versions: "highest" | ||
|
||
- name: "Check coding style" | ||
run: | | ||
composer global exec effigy format -- --headless | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/vendor | ||
composer.phar | ||
composer.lock | ||
.DS_Store | ||
Thumbs.db | ||
/phpunit.xml | ||
/.idea | ||
/.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
## v0.1.0 (2024-03-04) | ||
* Built initial implementation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Wellspring | ||
|
||
[![PHP from Packagist](https://img.shields.io/packagist/php-v/decodelabs/wellspring?style=flat)](https://packagist.org/packages/decodelabs/wellspring) | ||
[![Latest Version](https://img.shields.io/packagist/v/decodelabs/wellspring.svg?style=flat)](https://packagist.org/packages/decodelabs/wellspring) | ||
[![Total Downloads](https://img.shields.io/packagist/dt/decodelabs/wellspring.svg?style=flat)](https://packagist.org/packages/decodelabs/wellspring) | ||
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/decodelabs/wellspring/integrate.yml?branch=develop)](https://github.com/decodelabs/wellspring/actions/workflows/integrate.yml) | ||
[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-44CC11.svg?longCache=true&style=flat)](https://github.com/phpstan/phpstan) | ||
[![License](https://img.shields.io/packagist/l/decodelabs/wellspring?style=flat)](https://packagist.org/packages/decodelabs/wellspring) | ||
|
||
### PHP autoload management tools | ||
|
||
Wellspring provides simple tools to manage and configure autoloaders in PHP. | ||
|
||
_Get news and updates on the [DecodeLabs blog](https://blog.decodelabs.com)._ | ||
|
||
--- | ||
|
||
## Installation | ||
|
||
Install via Composer: | ||
|
||
```bash | ||
composer require decodelabs/wellspring | ||
``` | ||
|
||
## Usage | ||
|
||
Use <code>Wellspring</code> to register autoloaders with a Priority level - the higher the priority, the earlier the autoloader will be called. | ||
|
||
The library automatically remaps loaders on the fly when necessary (even when <code>spl_autoload_register()</code> and <code>spl_autoload_unregister()</code> are used directly), ensuring edge-case functionality does not interfere with the intended load order. | ||
|
||
Any loaders registered without a priority default to <code>Priority::Medium</code>, and any with matching priorities will be called in the order they were registered. | ||
|
||
```php | ||
use DecodeLabs\Wellspring; | ||
use DecodeLabs\Wellspring\Priority; | ||
|
||
Wellspring::register(function(string $class) { | ||
// This will get called last | ||
}, Priority::Low); | ||
|
||
Wellspring::register(function(string $class) { | ||
// This will get called first | ||
}, Priority::High); | ||
|
||
spl_autoload_register(function(string $class) { | ||
// This will get called second | ||
}); | ||
|
||
spl_autoload_call('test'); | ||
``` | ||
|
||
|
||
## Licensing | ||
|
||
Wellspring is licensed under the MIT License. See [LICENSE](./LICENSE) for the full license text. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name": "decodelabs/wellspring", | ||
"description": "PHP autoload management tools", | ||
"type": "library", | ||
"keywords": [ ], | ||
"license": "MIT", | ||
"authors": [ { | ||
"name": "Tom Wright", | ||
"email": "[email protected]" | ||
} ], | ||
"require": { | ||
"php": "^8.1" | ||
}, | ||
"require-dev": { | ||
"decodelabs/phpstan-decodelabs": "^0.6.7" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"DecodeLabs\\": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-develop": "0.1.x-dev" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
// ecs.php | ||
|
||
declare(strict_types=1); | ||
|
||
use Symplify\EasyCodingStandard\Config\ECSConfig; | ||
use Symplify\EasyCodingStandard\ValueObject\Set\SetList; | ||
|
||
return static function (ECSConfig $ecsConfig): void { | ||
$ecsConfig->paths([__DIR__.'/src']); | ||
$ecsConfig->sets([SetList::CLEAN_CODE, SetList::PSR_12]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
parameters: | ||
paths: | ||
- src | ||
level: max |
Oops, something went wrong.