Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
172 changes: 149 additions & 23 deletions CHANGELOG.md

Large diffs are not rendered by default.

60 changes: 31 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
- **🛡️ Segurança Integrada**: Middlewares prontos para CSRF, XSS, JWT - protótipos seguros desde o início.
- **🔧 Extensibilidade Simples**: Sistema de plugins e providers para expandir funcionalidades conforme necessário.
- **📊 Performance Adequada**: Throughput de 44,092 ops/sec, footprint de 1.61MB - suficiente para demonstrações.
- **🎨 v1.2.0**: Simplicity Edition - Arquitetura limpa, zero complexidade desnecessária, foco em simplicidade.
- **🎨 v2.0.0**: Legacy Cleanup Edition - 18% code reduction, modern namespaces, routing externalized, zero deprecated code.

---

Expand All @@ -34,15 +34,17 @@
- 🔐 **Autenticação Multi-método**
- 🛡️ **Segurança Avançada**
- 📡 **Streaming & SSE**
- 📚 **OpenAPI/Swagger Automático** (v1.2.0+ Middleware)
- 📚 **OpenAPI/Swagger Automático** (v2.0.0 Middleware)
- 🔄 **PSR-7 Híbrido**
- ♻️ **Object Pooling**
- 🚀 **JSON Optimization** (v1.2.0 Intelligent)
- 🎯 **Array Callables** (v1.2.0 Native)
- 🔍 **Enhanced Error Diagnostics** (v1.2.0)
- 🚀 **JSON Optimization** (Intelligent Caching)
- 🎯 **Array Callables** (Native Support)
- 🔍 **Enhanced Error Diagnostics**
- ⚡ **Performance Extrema**
- 🧪 **Qualidade e Testes**
- 🎯 **Simplicidade sobre Otimização** (v1.2.0)
- 🎯 **Simplicidade sobre Otimização**
- 🧹 **v2.0.0 Legacy Cleanup** (18% code reduction)
- 🔌 **Modular Routing** (External package, pluggable in v2.1.0)

---

Expand Down Expand Up @@ -116,7 +118,7 @@ $app->get('/posts/:year<\d{4}>/:month<\d{2}>/:slug<slug>', function($req, $res)
$app->run();
```

### 🛣️ Sintaxes de Roteamento Suportadas (v1.2.0)
### 🛣️ Sintaxes de Roteamento Suportadas

O PivotPHP oferece suporte robusto para múltiplas sintaxes de roteamento:

Expand Down Expand Up @@ -160,37 +162,37 @@ $app->get('/users/:id', [Controller::class, 'show']);

namespace App\Controllers;

class UserController
class UserController
{
// ✅ Métodos devem ser PÚBLICOS
public function index($req, $res)
public function index($req, $res)
{
$users = User::paginate($req->query('limit', 10));
return $res->json(['users' => $users]);
}
public function show($req, $res)

public function show($req, $res)
{
$id = $req->param('id');
$user = User::find($id);

if (!$user) {
return $res->status(404)->json(['error' => 'User not found']);
}

return $res->json(['user' => $user]);
}
public function store($req, $res)

public function store($req, $res)
{
$data = $req->body();
$user = User::create($data);

return $res->status(201)->json(['user' => $user]);
}
}

// ✅ Registrar rotas com array callable v1.2.0
// ✅ Registrar rotas com array callable
$app->get('/users', [UserController::class, 'index']);
$app->get('/users/:id<\d+>', [UserController::class, 'show']); // Apenas números
$app->post('/users', [UserController::class, 'store']);
Expand All @@ -200,10 +202,10 @@ $app->put('/users/:id', [UserController::class, 'update'])
->middleware($authMiddleware);
```

#### ⚡ Validação Automática (v1.2.0)
#### ⚡ Validação Automática

```php
// O PivotPHP v1.2.0 valida automaticamente array callables:
// O PivotPHP valida automaticamente array callables:

// ✅ Método público - ACEITO
class PublicController {
Expand Down Expand Up @@ -265,17 +267,17 @@ $response = OptimizedHttpFactory::createResponse();
- ✅ **API Express.js** mantida para produtividade
- ✅ **Zero breaking changes** - código existente funciona sem alterações

### 🚀 JSON Optimization (v1.2.0 Intelligent System)
### 🚀 JSON Optimization (Intelligent System)

O PivotPHP v1.2.0 mantém o **threshold inteligente de 256 bytes** no sistema de otimização JSON, eliminando overhead para dados pequenos:
O PivotPHP mantém o **threshold inteligente de 256 bytes** no sistema de otimização JSON, eliminando overhead para dados pequenos:

#### ⚡ Sistema Inteligente Automático

```php
// ✅ OTIMIZAÇÃO AUTOMÁTICA - Zero configuração necessária
$app->get('/api/users', function($req, $res) {
$users = User::all();

// Sistema decide automaticamente:
// • Poucos usuários (<256 bytes): json_encode() direto
// • Muitos usuários (≥256 bytes): pooling automático
Expand All @@ -288,10 +290,10 @@ $app->get('/api/users', function($req, $res) {
```php
// Dados pequenos (<256 bytes) - json_encode() direto
$smallData = ['status' => 'ok', 'count' => 42];
$json = JsonBufferPool::encodeWithPool($smallData);
$json = JsonBufferPool::encodeWithPool($smallData);
// Performance: 500K+ ops/sec (sem overhead)

// Dados médios (256 bytes - 10KB) - pooling automático
// Dados médios (256 bytes - 10KB) - pooling automático
$mediumData = User::paginate(20);
$json = JsonBufferPool::encodeWithPool($mediumData);
// Performance: 119K+ ops/sec (15-30% ganho)
Expand Down Expand Up @@ -327,7 +329,7 @@ echo "Eficiência: {$stats['efficiency']}%\n";
echo "Operações: {$stats['total_operations']}\n";
```

#### ✨ Mantido v1.2.0
#### ✨ Mantido v2.0.0

- ✅ **Threshold Inteligente** - Elimina overhead para dados <256 bytes
- ✅ **Detecção Automática** - Sistema decide quando usar pooling
Expand All @@ -336,7 +338,7 @@ echo "Operações: {$stats['total_operations']}\n";
- ✅ **Monitoramento Integrado** - Estatísticas em tempo real
- ✅ **Compatibilidade Total** - Drop-in replacement transparente

### 🔍 Enhanced Error Diagnostics (v1.2.0)
### 🔍 Enhanced Error Diagnostics

PivotPHP v1.2.0 mantém **ContextualException** para diagnósticos avançados de erros:

Expand Down Expand Up @@ -367,7 +369,7 @@ try {
```php
// Automaticamente detectadas pelo sistema
ContextualException::CATEGORY_ROUTING // Problemas de roteamento
ContextualException::CATEGORY_PARAMETER // Validação de parâmetros
ContextualException::CATEGORY_PARAMETER // Validação de parâmetros
ContextualException::CATEGORY_VALIDATION // Validação de dados
ContextualException::CATEGORY_MIDDLEWARE // Problemas de middleware
ContextualException::CATEGORY_HTTP // Erros HTTP
Expand Down Expand Up @@ -402,9 +404,9 @@ ContextualException::configure([
- ✅ **Segurança por Ambiente** - Detalhes reduzidos em produção
- ✅ **Logging Integrado** - Registro automático para análise posterior

📖 **Documentação completa:**
📖 **Documentação completa:**
- [Array Callable Guide](docs/technical/routing/ARRAY_CALLABLE_GUIDE.md)
- [JsonBufferPool Optimization Guide](docs/technical/json/BUFFER_POOL_OPTIMIZATION.md)
- [JsonBufferPool Optimization Guide](docs/technical/json/BUFFER_POOL_OPTIMIZATION.md)
- [Enhanced Error Diagnostics](docs/technical/error-handling/CONTEXTUAL_EXCEPTION_GUIDE.md)

### 📖 Documentação OpenAPI/Swagger Automática (v1.2.0+)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.0
2.0.0
13 changes: 9 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pivotphp/core",
"description": "PivotPHP Core v1.2.0 - Simplified high-performance microframework with automatic OpenAPI/Swagger documentation, PSR-7 hybrid support, and Express.js-inspired API",
"description": "PivotPHP Core v2.0.0 - Modular high-performance microframework with pluggable routing system, automatic OpenAPI/Swagger documentation, PSR-7 hybrid support, and Express.js-inspired API",
"type": "library",
"keywords": [
"php",
Expand Down Expand Up @@ -43,11 +43,14 @@
"psr/container": "^2.0",
"psr/event-dispatcher": "^1.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.1",
"psr/http-message": "^1.1|^2.0",
"psr/http-server-handler": "^1.0",
"psr/http-server-middleware": "^1.0",
"psr/log": "^3.0",
"react/http": "^1.9"
"psr/cache": "^2.0|^3.0",
"psr/simple-cache": "^2.0|^3.0",
"react/http": "^1.9",
"pivotphp/core-routing": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^9.0|^10.0",
Expand All @@ -62,7 +65,9 @@
"ext-openssl": "Required for secure token generation",
"ext-mbstring": "Required for proper string handling",
"ext-fileinfo": "Required for file upload validation",
"ext-apcu": "For caching middleware and performance optimization"
"ext-apcu": "For caching middleware and performance optimization",
"pivotphp/cycle-orm": "Database ORM integration for PivotPHP",
"pivotphp/reactphp": "Async runtime extension for continuous execution"
},
"autoload": {
"psr-4": {
Expand Down
36 changes: 21 additions & 15 deletions docs/MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@

**For detailed migration instructions, please refer to the official release documentation:**

### 🔄 Latest Version: v1.1.4
**[Complete Migration Guide →](releases/v1.1.4/MIGRATION_GUIDE.md)**
### 🔄 Latest Version: v2.0.0 ⚠️ BREAKING RELEASE
**[Complete Migration Guide →](releases/v2.0.0/MIGRATION_GUIDE_v2.0.0.md)**

**Migration highlights:**
- **🔧 Infrastructure Consolidation**: 40% script reduction (25 → 15)
- **📦 Automatic Version Management**: VERSION file requirement with strict validation
- **🚀 GitHub Actions Optimization**: 25% workflow reduction (4 → 3)
- **✅ Zero Breaking Changes**: 100% backward compatibility maintained
- **🗑️ Legacy Cleanup**: 18% code reduction (11,871 lines removed)
- **📦 Namespace Modernization**: 110 legacy aliases removed
- **🚀 Performance**: 59% fewer aliases to autoload
- **⚠️ Breaking Changes**: Required namespace updates for middleware
- **✅ Zero Regressions**: All 5,548 tests passing (100%)

### 📚 Version-Specific Migration Guides

| From Version | Migration Guide | Effort Level |
|--------------|----------------|--------------|
| **v1.x → v2.0.0** | [v2.0.0 Migration Guide](releases/v2.0.0/MIGRATION_GUIDE_v2.0.0.md) | **Medium** ⚠️ BREAKING |
| **v1.1.3** | [v1.1.4 Migration Guide](releases/v1.1.4/MIGRATION_GUIDE.md) | **Low** (mostly optional) |
| **v1.1.2** | [v1.1.4 Migration Guide](releases/v1.1.4/MIGRATION_GUIDE.md) | **Low** (infrastructure only) |
| **v1.1.1** | [v1.1.4 Migration Guide](releases/v1.1.4/MIGRATION_GUIDE.md) | **Low** (backward compatible) |
Expand All @@ -25,15 +27,19 @@

### 🎯 Quick Migration Checklist

#### ⚠️ Required Actions (v1.1.4):
- [ ] **Create VERSION file** in project root: `echo "1.1.4" > VERSION`
- [ ] **Update script references** in custom CI/CD (if any)
- [ ] **Test consolidated scripts** work correctly
#### ⚠️ Required Actions (v2.0.0) - BREAKING CHANGES:
- [ ] **Update PSR-15 middleware imports** (8 classes - see migration guide)
- [ ] **Remove "Simple*" prefixes** (7 classes - PerformanceMode, LoadShedder, etc.)
- [ ] **Replace OpenApiExporter** with ApiDocumentationMiddleware
- [ ] **Update DynamicPoolManager** → PoolManager
- [ ] **Run tests**: `composer test`
- [ ] **Regenerate autoloader**: `composer dump-autoload`

#### ✅ Recommended Actions:
- [ ] **Use consolidated scripts** (`scripts/quality/quality-check.sh`)
- [ ] **Adopt automatic versioning** (`scripts/release/version-bump.sh`)
- [ ] **Read versioning guide** ([docs/VERSIONING_GUIDE.md](VERSIONING_GUIDE.md))
#### ✅ Recommended Actions (v2.0.0):
- [ ] **Use migration script** (provided in v2.0.0 migration guide)
- [ ] **Review cleanup analysis** ([docs/v2.0.0-cleanup-analysis.md](v2.0.0-cleanup-analysis.md))
- [ ] **Update IDE configuration** for new namespaces
- [ ] **Review updated examples** in `examples/` directory

### 📖 Additional Resources

Expand All @@ -54,4 +60,4 @@ If you encounter migration issues:

---

**Note**: This general migration guide has been replaced by version-specific documentation for better accuracy and detail. Please use the appropriate version-specific guide above.
**Note**: This general migration guide has been replaced by version-specific documentation for better accuracy and detail. Please use the appropriate version-specific guide above.
10 changes: 2 additions & 8 deletions docs/releases/FRAMEWORK_OVERVIEW_v1.2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,7 @@ src/
└── Utils/ # Helper utilities
```

### **Deprecated/Legacy**
```
src/Legacy/
├── Performance/ # HighPerformanceMode (deprecated)
├── Middleware/ # Complex middleware (deprecated)
└── Utils/ # Legacy utilities
```
**Nota**: O diretório `src/Legacy/` foi removido na v2.0.0. Classes legacy foram completamente eliminadas em favor de implementações simplificadas.

## 🔧 Performance Mode (Simplified)

Expand Down Expand Up @@ -184,4 +178,4 @@ Se você precisa de um framework com equipe dedicada e suporte empresarial, cons

---

**PivotPHP Core v1.2.0** - Simplicity in Action 🚀
**PivotPHP Core v1.2.0** - Simplicity in Action 🚀
Loading
Loading