Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

All notable changes to this project are documented in this file.

This project uses [Semantic Versioning](https://semver.org/) beginning with version `v0.1.7-alpha.2` (or `v0.1.7-beta.1`).
This project uses [Semantic Versioning](https://semver.org/) beginning with version `v0.1.7-alpha.2` (or `v0.1.7`).
Earlier releases (`v0.1.0-alpha.1` to `v0.1.7-alpha.1`) were experimental and do not strictly follow SemVer conventions.

---
Expand Down Expand Up @@ -59,7 +59,7 @@ These were single-shot development releases with no progressive alpha/beta cycle

**From v0.1.7-alpha.2 onward, all releases will follow a structured, progressive SemVer pre-release cycle.**

## [v0.1.7-beta.1] - 2024-06-09
## [v0.1.7] - 2025-07-18

### Added
- Dynamic route parameter support (e.g., `/user/{id}`, `/blog/{slug}`) for CRUD and flexible routing
Expand Down
55 changes: 54 additions & 1 deletion DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ server {
}
```

## [v0.1.7-beta.1] - 2024-06-09
## [v0.1.7] - 2025-07-18

### New Features & Improvements

Expand Down Expand Up @@ -95,6 +95,26 @@ server {
- **CLI** for scaffolding and project management
- **Error pages** and basic debug tools

## Routing

SproutPHP supports flexible route parameters (like most modern frameworks):

| Pattern | Matches | Example URI | Notes |
| ------------------ | ------- | ------------------------ | --------------------------- |
| `/user/{id}` | Yes | `/user/123` | `{id}` = 123 |
| `/user/{id?}` | Yes | `/user/123`, `/user` | `{id}` = 123 or null |
| `/file/{path:.+}` | Yes | `/file/foo/bar` | `{path}` = foo/bar |
| `/file/{path?:.+}` | Yes | `/file`, `/file/foo/bar` | `{path}` = foo/bar or null |
| `/blog/{slug}` | Yes | `/blog/hello-world` | `{slug}` = hello-world |
| `/blog/{slug}` | No | `/blog/hello/world` | `{slug}` does not match `/` |

- <code>{param}</code> — required parameter (matches anything except <code>/</code>)
- <code>{param?}</code> — optional parameter (trailing slash and parameter are optional)
- <code>{param:regex}</code> — required with custom regex
- <code>{param?:regex}</code> — optional with custom regex

Optional parameters are passed as <code>null</code> if missing. For catch-all (wildcard) parameters, use a custom regex like <code>{path:.+}</code>.

## Example: Hello World Route

```php
Expand Down Expand Up @@ -371,3 +391,36 @@ You do **not** need to install or include HTMX or PicoCSS yourself—they are al
```

```

## Testing Your SproutPHP App

SproutPHP is compatible with [PHPUnit](https://phpunit.de/) and other popular PHP testing tools.

1. **Install PHPUnit (dev only):**
```sh
composer require --dev phpunit/phpunit
```
2. **Create a `tests/` directory** in your project root.
3. **Add a sample test:**

```php
// tests/ExampleTest.php
use PHPUnit\Framework\TestCase;

class ExampleTest extends TestCase
{
public function testBasicAssertion()
{
$this->assertTrue(true);
}
}
```

4. **Run your tests:**
```sh
./vendor/bin/phpunit
```

You can test any part of your app: helpers, models, controllers, middleware, etc. Use mocks and stubs as needed.

> **Note:** SproutPHP does not include test files by default. You are free to organize and write tests as you see fit for your project.
4 changes: 2 additions & 2 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Release Notes: v0.1.7-beta.1 (2024-06-09)
# Release Notes: v0.1.7 (2025-07-18)

## Highlights

- **First Beta Release!** SproutPHP is now feature-complete and ready for broader testing and feedback.
- **First Stable Release!** SproutPHP is now production-ready, stable, and suitable for real-world projects.
- **Dynamic Routing:** Support for route parameters (e.g., `/user/{id}`, `/file/{filename:.+}`) enables full CRUD and flexible APIs.
- **CSRF Protection:** Robust, middleware-based CSRF protection for all state-changing requests (forms, AJAX, HTMX).
- **SPA-like UX:** HTMX-powered forms and file uploads for a modern, seamless user experience.
Expand Down
Loading