Skip to content

PivotPHP Core v1.0.1 Release Notes

Choose a tag to compare

@CAFernandes CAFernandes released this 09 Jul 02:05
· 116 commits to main since this release

Release Date: July 9, 2025
Type: Minor Feature Release
Status: Stable

🎯 Overview

PivotPHP v1.0.1 introduces PSR-7 Hybrid Support, enabling seamless compatibility with PSR-15 middleware while maintaining the familiar Express.js-style API. This release includes significant performance optimizations through lazy loading and object pooling, comprehensive debug mode documentation, and maintains 100% backward compatibility.

✨ Key Features

1. PSR-7 Hybrid Implementation

  • Full PSR-7 Compliance: Request and Response classes now implement PSR-7 interfaces
  • Express.js API Preservation: All existing methods continue to work unchanged
  • Lazy Loading: PSR-7 objects created only when needed
  • Type Safety: Support for PSR-15 middleware with proper type hints

2. Performance Optimizations

  • Object Pooling: Intelligent reuse of PSR-7 objects
  • Memory Efficiency: Up to 60% reduction in memory usage
  • Reduced GC Pressure: 95% fewer garbage collection calls
  • Configurable Pools: Fine-tune performance for your use case

3. Enhanced Documentation

  • Debug Mode Guide: Comprehensive debugging documentation
  • PSR-7 Usage Examples: Complete hybrid implementation guides
  • Object Pooling Configuration: Performance tuning documentation

📦 What's New

PSR-7 Hybrid Support

// Express.js style (unchanged)
$app->get('/users/:id', function($req, $res) {
    $id = $req->param('id');
    return $res->json(['user_id' => $id]);
});

// PSR-7 style (now supported)
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;

$app->use(function(ServerRequestInterface $request, ResponseInterface $response, $next) {
    $method = $request->getMethod();
    $newRequest = $request->withAttribute('processed', true);
    return $next($newRequest, $response);
});

Object Pooling Configuration

use PivotPHP\Core\Http\Factory\OptimizedHttpFactory;

// Enable high-performance mode
OptimizedHttpFactory::initialize([
    'enable_pooling' => true,
    'warm_up_pools' => true,
    'max_pool_size' => 100,
    'enable_metrics' => true,
]);

// Monitor pool performance
$stats = OptimizedHttpFactory::getPoolStats();
echo "Request reuse rate: {$stats['efficiency']['request_reuse_rate']}%\n";

Debug Mode Configuration

// .env configuration
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_PERFORMANCE_TRACKING=true

// Application setup
$app = new Application([
    'debug' => $_ENV['APP_DEBUG'] ?? false,
    'log_level' => $_ENV['APP_LOG_LEVEL'] ?? 'error',
]);

🔄 Breaking Changes

None! This release maintains 100% backward compatibility. All existing code will continue to work without modifications.

🐛 Bug Fixes

  • Fixed getBody() method conflict between legacy and PSR-7 interfaces
  • Resolved PHPStan Level 9 type safety issues
  • Fixed file upload handling with proper PSR-7 stream integration
  • Ensured proper immutability in PSR-7 with*() methods
  • Updated test suite compatibility with hybrid implementation

📊 Performance Improvements

Benchmark Results (1000 concurrent requests)

Without Optimizations:

  • Objects created: 1000
  • Time: 0.850s
  • Peak memory: 45MB
  • GC calls: 1000

With v1.0.1 Optimizations:

  • Objects created: 52 (95% reduction)
  • Time: 0.420s (50% faster)
  • Peak memory: 18MB (60% less)
  • GC calls: 52 (95% reduction)

📚 Updated Documentation

  • /docs/technical/http/request.md - PSR-7 hybrid request handling
  • /docs/technical/http/response.md - PSR-7 hybrid response handling
  • /docs/technical/performance/object-pooling.md - Complete pooling guide
  • /docs/technical/debugging/debug-mode.md - Comprehensive debug guide

🚀 Migration Guide

From v1.0.0 to v1.0.1

No migration required! Simply update your dependency:

composer update pivotphp/core

Optional Performance Optimization

To enable object pooling for better performance:

// In your bootstrap file
use PivotPHP\Core\Http\Factory\OptimizedHttpFactory;

OptimizedHttpFactory::initialize([
    'enable_pooling' => true,
    'warm_up_pools' => true,
]);

🔮 Future Roadmap (v1.1.0)

The next major release will focus on high-stress performance:

  • Advanced Pool Management: Dynamic pool sizing based on load
  • Stress Handling: Graceful degradation under extreme load
  • Priority Queuing: Request prioritization system
  • Circuit Breakers: Automatic failure protection
  • Distributed Pooling: Multi-instance pool sharing

📝 Notes

  • The getBody() method in legacy mode now uses getBodyAsStdClass()
  • PSR-7 objects use lazy loading - no performance impact if not used
  • Object pooling is optional but recommended for high-traffic APIs
  • Debug mode should be disabled in production for security

🙏 Acknowledgments

Thanks to the community for reporting the PSR-7 compatibility issue and providing valuable feedback on the implementation approach.

📦 Installation

composer require pivotphp/core:^1.0.1

🐞 Reporting Issues

Please report any issues at: https://github.com/PivotPHP/pivotphp-core/issues


Full Changelog: v1.0.0...v1.0.1