Skip to content

Commit c0bdd98

Browse files
committed
Add documentation and examples for Fast Forward Iterators
- Migrated to PHP 8.3+. - Introduced a new documentation section for iterators, detailing core iterator classes and their functionalities. - Created a "Getting Started" guide with installation instructions and a quickstart example. - Added usage patterns and real-world use cases for various iterators, including chunking, sliding windows, unique filtering, and lookahead/lookbehind. - Updated examples to reflect new iterator functionalities and improved code clarity. - Enhanced copyright information in example files to reflect the updated year and added relevant links. - Added Unit Tests. Signed-off-by: Felipe Sayão Lobato Abreu <github@mentordosnerds.com>
1 parent 0e34e58 commit c0bdd98

89 files changed

Lines changed: 3663 additions & 554 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.docheader

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
* This source file is subject to the license that is bundled
55
* with this source code in the file LICENSE.
66
*
7-
* @link https://github.com/php-fast-forward/iterators
87
* @copyright Copyright (c) 2025-%year% Felipe Sayão Lobato Abreu <github@mentordosnerds.com>
98
* @license https://opensource.org/licenses/MIT MIT License
9+
*
10+
* @see https://github.com/php-fast-forward/iterators
11+
* @see https://github.com/php-fast-forward
12+
* @see https://datatracker.ietf.org/doc/html/rfc2119
1013
*/

.github/dependabot.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "composer"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
commit-message:
8+
prefix: "Composer"
9+
include: "scope"
10+
labels:
11+
- "composer"
12+
- "dependencies"
13+
14+
- package-ecosystem: "github-actions"
15+
directory: "/"
16+
schedule:
17+
interval: "weekly"
18+
commit-message:
19+
prefix: "GitHub Actions"
20+
include: "scope"
21+
labels:
22+
- "github-actions"
23+
- "continuous-integration"

.github/workflows/reports.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: "Fast Forward Reports"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pages: write
12+
id-token: write
13+
14+
jobs:
15+
reports:
16+
uses: php-fast-forward/dev-tools/.github/workflows/reports.yml@main
17+
secrets: inherit

.github/workflows/tests.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: "Fast Forward Test Suite"
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: write
9+
pages: write
10+
id-token: write
11+
12+
jobs:
13+
tests:
14+
uses: php-fast-forward/dev-tools/.github/workflows/tests.yml@main
15+
secrets: inherit

.github/workflows/wiki.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: "Fast Forward Wiki Update"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pages: write
12+
id-token: write
13+
14+
jobs:
15+
wiki:
16+
uses: php-fast-forward/dev-tools/.github/workflows/wiki.yml@main
17+
secrets: inherit

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.idea/
2+
.vscode/
23
public/
4+
tmp/
35
vendor/
46
composer.lock
57
*.cache

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule ".github/wiki"]
2+
path = .github/wiki
3+
url = git@github.com:php-fast-forward/iterators.wiki.git

.php-cs-fixer.php

Lines changed: 0 additions & 25 deletions
This file was deleted.

README.md

Lines changed: 73 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# FastForward\Iterators
22

3-
[![PHP Version](https://img.shields.io/badge/php-7.4%20%7C%208.0%2B-blue.svg)](https://www.php.net/)
3+
[![PHP Version](https://img.shields.io/badge/php-8.3%2B-blue.svg)](https://www.php.net/)
44
[![License](https://img.shields.io/github/license/php-fast-forward/iterators)](https://opensource.org/licenses/MIT)
55

6-
A robust and optimized library for advanced PHP Iterators.
7-
Enhance your PHP applications with high-performance iterators, supporting lookahead, peeking, filtering, grouping, and more.
6+
A robust and optimized library for advanced PHP Iterators.
7+
8+
Enhance your PHP applications with high-performance iterators: lookahead, peeking, filtering, grouping, chunking, and more.
9+
10+
---
811

912
## ✨ Features
1013

@@ -19,14 +22,77 @@ Enhance your PHP applications with high-performance iterators, supporting lookah
1922
Install via Composer:
2023

2124
```bash
22-
composer require fast-forward/iterators
25+
composer require php-fast-forward/iterators
2326
```
2427

25-
## 🛠 Usage
28+
**Requirements:** PHP 8.3 or higher
29+
30+
## 🚀 Quickstart
31+
32+
```php
33+
use FastForward\Iterator\ChunkedIteratorAggregate;
34+
35+
$data = range(1, 10);
36+
$chunked = new ChunkedIteratorAggregate($data, 3);
37+
foreach ($chunked as $chunk) {
38+
print_r($chunk);
39+
}
40+
```
41+
42+
**Expected output:**
43+
44+
```
45+
Array
46+
(
47+
[0] => 1
48+
[1] => 2
49+
[2] => 3
50+
)
51+
Array
52+
(
53+
[0] => 4
54+
[1] => 5
55+
[2] => 6
56+
)
57+
Array
58+
(
59+
[0] => 7
60+
[1] => 8
61+
[2] => 9
62+
)
63+
Array
64+
(
65+
[0] => 10
66+
)
67+
```
68+
69+
## 🛠 Usage Patterns
70+
71+
All iterators and utilities are available under the `FastForward\Iterator` namespace. Simply require Composer's autoloader:
72+
73+
```php
74+
require_once 'vendor/autoload.php';
75+
use FastForward\Iterator\ChunkedIteratorAggregate;
76+
use FastForward\Iterator\SlidingWindowIteratorIterator;
77+
// ...
78+
```
79+
80+
You can chain, compose, and adapt iterators for a wide variety of data processing tasks.
81+
82+
## 📚 Documentation & Examples
83+
84+
- 📖 [Full Documentation](https://github.com/php-fast-forward/iterators/tree/main/docs)
85+
- 🧑‍💻 [Examples Directory](https://github.com/php-fast-forward/iterators/tree/main/examples)
86+
- Each file demonstrates a specific iterator or pattern:
87+
- [chunked-iterator-aggregate.php](https://github.com/php-fast-forward/iterators/blob/main/examples/chunked-iterator-aggregate.php)
88+
- [sliding-window-iterator-iterator.php](https://github.com/php-fast-forward/iterators/blob/main/examples/sliding-window-iterator-iterator.php)
89+
- [unique-iterator-iterator.php](https://github.com/php-fast-forward/iterators/blob/main/examples/unique-iterator-iterator.php)
90+
- [lookahead-iterator.php](https://github.com/php-fast-forward/iterators/blob/main/examples/lookahead-iterator.php)
91+
- ...and more!
2692

27-
This package provides various iterator utilities under the `FastForward\Iterator` namespace.
93+
## 🤝 Contributing
2894

29-
Check out the [`examples/`](https://github.com/php-fast-forward/iterators/tree/main/examples) directory for hands-on usage of each iterator.
95+
Contributions, bug reports and suggestions are welcome! Please open an issue or pull request on [GitHub](https://github.com/php-fast-forward/iterators).
3096

3197
## 🧑‍💻 Author
3298

composer.json

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,10 @@
2323
"source": "https://github.com/php-fast-forward/iterators"
2424
},
2525
"require": {
26-
"php": "^8.1"
26+
"php": "^8.3"
2727
},
2828
"require-dev": {
29-
"coisa/php-cs-fixer": "^2.1",
30-
"infection/infection": "^0.29",
31-
"phpstan/phpstan": "^2.1",
32-
"phpunit/phpunit": "^9.6 || ^10.5 || ^11.5"
29+
"fast-forward/dev-tools": "dev-main"
3330
},
3431
"minimum-stability": "stable",
3532
"autoload": {
@@ -42,25 +39,26 @@
4239
},
4340
"config": {
4441
"allow-plugins": {
45-
"infection/extension-installer": true
42+
"ergebnis/composer-normalize": true,
43+
"fast-forward/dev-tools": true,
44+
"phpdocumentor/shim": true,
45+
"phpro/grumphp": true
46+
},
47+
"platform": {
48+
"php": "8.3.0"
4649
},
4750
"sort-packages": true
4851
},
4952
"extra": {
5053
"branch-alias": {
5154
"dev-main": "1.x-dev"
55+
},
56+
"grumphp": {
57+
"config-default-path": "vendor/fast-forward/dev-tools/grumphp.yml"
5258
}
5359
},
5460
"scripts": {
55-
"cs-check": "php-cs-fixer fix --dry-run --diff",
56-
"cs-fix": "php-cs-fixer fix",
57-
"mutation-testing": "infection --threads=4",
58-
"pre-commit": [
59-
"@cs-check",
60-
"@static-analysis",
61-
"@tests"
62-
],
63-
"static-analysis": "phpstan analyse --level 5 src",
64-
"tests": "phpunit --testdox"
61+
"dev-tools": "dev-tools",
62+
"dev-tools:fix": "@dev-tools --fix"
6563
}
6664
}

0 commit comments

Comments
 (0)