You Probably Want stonescriptphp-server Instead!
This repository contains the core framework library. Most developers should use the application skeleton to get started:
# β
RECOMMENDED: Create a new project with the application skeleton
composer create-project progalaxyelabs/stonescriptphp-server my-api
cd my-api
php stone serveWhy use stonescriptphp-server?
- Includes complete project structure
- Pre-configured routes and examples
stoneCLI entry point ready to use- Environment setup automated
- This framework (stonescriptphp) is automatically installed as a dependency
- CLI tools auto-update with
composer update
Only install this framework package directly if you're:
- β Contributing to the framework core
- β Building custom framework extensions or plugins
- β Integrating StoneScriptPHP into an existing project
- β Creating your own custom project template
# Direct installation (advanced usage only)
composer require progalaxyelabs/stonescriptphpA modern PHP backend framework for building APIs with PostgreSQL, inspired by Angular routing, MCP-style CLI commands, and Laravel's elegance for a streamlined developer experience.
Built for developers who value clean architecture and rapid API development, StoneScriptPHP combines PostgreSQL's power with an intuitive CLI workflow.
| Package | Purpose | When to Use |
|---|---|---|
| stonescriptphp-server | Application skeleton | β Start here - Creating new projects |
| stonescriptphp | Core framework | Advanced - Framework development, custom integrations |
- CLI Tools - Code generators in
cli/directory (used viaphp stonefrom server package) - PostgreSQL-first - Built for PostgreSQL with migration system
- Fast Development - Code generators for routes, models, migrations
- Auto-updates - CLI tools update automatically with
composer update
- JWT Authentication - RSA & HMAC support, built-in OAuth (Google)
- RBAC - Role-Based Access Control with permissions
- Security Middleware - CORS, rate limiting, security headers
- Redis Caching - Optional Redis integration with cache tags, TTL, automatic invalidation
- Production Logging - PSR-3 compatible, console + file output, colorized
- Exception Handling - Global exception handler with structured errors
- Validation Layer - Powerful request validation with 12+ built-in rules
- Color-Coded Logs - Beautiful ANSI-colored console output
- Comprehensive Docs - 20+ documentation files (600+ pages)
- Testing - PHPUnit test suite included
- VS Code Extension - Snippets and IntelliSense
# Create a new project
composer create-project progalaxyelabs/stonescriptphp-server my-api
cd my-api
# Start development server
php stone serve
# Your API is running at http://localhost:9100π View Full Getting Started Guide
Update framework and CLI tools:
# Update framework (vendor packages)
composer update progalaxyelabs/stonescriptphp
# Update CLI tools (project files)
php stone upgradeCheck for updates without installing:
php stone upgrade --checkSee docs/UPGRADE.md for version-specific migration guides.
Create tables in src/App/Database/postgres/tables/table_name.pssql
Create functions in src/App/Database/postgres/functions/function_name.pssql
-- Example: get_users.pssql
CREATE OR REPLACE FUNCTION get_users()
RETURNS TABLE (
id INTEGER,
name VARCHAR(100),
email VARCHAR(255)
) AS $$
BEGIN
RETURN QUERY
SELECT u.id, u.name, u.email
FROM users u
ORDER BY u.id DESC;
END;
$$ LANGUAGE plpgsql;php stone generate model get_users.pssqlCreates FnGetUsers.php in src/App/Database/Functions/
php stone generate route get-usersIn src/App/Config/routes.php:
return [
'GET' => [
'/api/users' => GetUsersRoute::class,
],
];class GetUsersRoute implements IRouteHandler
{
public function validation_rules(): array
{
return []; // No validation needed for GET
}
public function process(): ApiResponse
{
$users = FnGetUsers::run();
return res_ok(['users' => $users]);
}
}php stone migrate verifyLocation: cli/ directory in this package
Usage: Via php stone command from stonescriptphp-server
The framework now bundles all CLI code generators. When you run composer update, the CLI tools automatically update along with the framework.
# Run from stonescriptphp-server project:
php stone generate route <name> # Generate route handler
php stone generate model <file.pgsql> # Generate model from SQL function
php stone generate auth:google # Generate OAuth authentication
php stone migrate verify # Check database driftSee stonescriptphp-server for complete CLI documentation.
StoneScriptPHP follows a PostgreSQL-first architecture:
- Business Logic in Database - SQL functions encapsulate complex queries and business rules
- Type-Safe PHP Models - Generated classes wrap SQL functions with PHP typing
- Thin Route Layer - Routes handle HTTP concerns (validation, auth, responses)
- Clean Separation - Database β Models β Services β Routes β Frontend
This approach:
- Leverages PostgreSQL's procedural capabilities
- Keeps logic close to the data
- Enables database performance optimization
- Facilitates testing and maintenance
- PHP >= 8.2
- PostgreSQL >= 13
- Composer
- PHP Extensions:
pdo,pdo_pgsql,json,openssl
- Redis server (for caching support)
- PHP Extension:
redis(for Redis caching)
- π Documentation Index - Complete documentation with navigation
- ποΈ High Level Design (HLD) - System architecture and company work-management
- π Release Notes - Version history
- Getting Started Guide
- CLI Usage Guide
- Environment Configuration
- Setup Quiet Mode - CI/CD and Docker automation
- Authentication
- JWT Configuration
- RBAC (Access Control)
- RBAC Quickstart
- Security Best Practices
- CSRF Protection
- Bot Protection
We welcome contributions! This repository is for framework core development.
# Clone the framework repository
git clone https://github.com/progalaxyelabs/StoneScriptPHP.git
cd StoneScriptPHP
# Install dependencies
composer install
# Run tests
composer testTo test framework changes in a project without publishing:
// In your test project's composer.json
{
"repositories": [
{
"type": "path",
"url": "../StoneScriptPHP",
"options": {"symlink": false}
}
],
"require": {
"progalaxyelabs/stonescriptphp": "@dev"
}
}Then run composer update progalaxyelabs/stonescriptphp
StoneScriptPHP follows Semantic Versioning:
- Patch versions (2.0.x): Bug fixes, security patches. Safe to update anytime.
- Minor versions (2.x.0): New features, backward-compatible. Update when needed.
- Major versions (x.0.0): Breaking changes. Review migration guide first.
Current stable: v2.0.x - Production-ready with ongoing bug fixes
- stonescriptphp-server - Application skeleton (recommended for new projects)
- Website: stonescriptphp.org
- Documentation: stonescriptphp.org/docs
- Framework Issues: GitHub Issues
- Discussions: GitHub Discussions
MIT License - see LICENSE file for details
Most developers should start with the application skeleton:
composer create-project progalaxyelabs/stonescriptphp-server my-apiThis framework package is automatically included as a dependency. Visit stonescriptphp-server to get started!