{"id":35578957,"url":"https://github.com/timanthonyalexander/base-api","last_synced_at":"2026-04-18T23:06:45.866Z","repository":{"id":313994151,"uuid":"1053736057","full_name":"TimAnthonyAlexander/base-api","owner":"TimAnthonyAlexander","description":"A production-ready KISS-first PHP 8.4+ framework for building REST APIs.","archived":false,"fork":false,"pushed_at":"2026-02-02T19:46:22.000Z","size":4639,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-03T10:23:14.748Z","etag":null,"topics":["api","deepl","framework","i18n","microframework","migrations","openai","openapi","orm","php","php-8","rest","translations","typescript"],"latest_commit_sha":null,"homepage":"https://base-api.de","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TimAnthonyAlexander.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-09T21:22:35.000Z","updated_at":"2026-02-02T19:46:28.000Z","dependencies_parsed_at":"2025-10-19T14:38:30.113Z","dependency_job_id":"8625b2d0-ae38-4776-8e4d-ddd68e44cc4d","html_url":"https://github.com/TimAnthonyAlexander/base-api","commit_stats":null,"previous_names":["timanthonyalexander/base-api"],"tags_count":122,"template":false,"template_full_name":null,"purl":"pkg:github/TimAnthonyAlexander/base-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimAnthonyAlexander%2Fbase-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimAnthonyAlexander%2Fbase-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimAnthonyAlexander%2Fbase-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimAnthonyAlexander%2Fbase-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimAnthonyAlexander","download_url":"https://codeload.github.com/TimAnthonyAlexander/base-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimAnthonyAlexander%2Fbase-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29658167,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T16:33:43.953Z","status":"ssl_error","status_checked_at":"2026-02-20T16:33:43.598Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","deepl","framework","i18n","microframework","migrations","openai","openapi","orm","php","php-8","rest","translations","typescript"],"created_at":"2026-01-04T20:12:11.545Z","updated_at":"2026-02-20T17:01:14.805Z","avatar_url":"https://github.com/TimAnthonyAlexander.png","language":"PHP","readme":"# BaseAPI\n\n[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/TimAnthonyAlexander/base-api-template?quickstart=1)\n\nA tiny, KISS-first PHP 8.4+ framework for building production-ready REST APIs.\n\nBaseAPI gets out of your way and lets you build APIs in minutes, not hours. Define your models with typed properties, write minimal controllers, and let the framework handle migrations, validation, caching, and documentation automatically.\n\n**[Read the Documentation](https://base-api.de)**\n\n---\n\n## Quick Start\n\n```bash\ncomposer create-project baseapi/baseapi-template my-api\ncd my-api\nphp mason serve\n```\n\nYour API is now running at `http://localhost:7879`.\n\n---\n\n## How Fast Is It to Code?\n\n### Define a Model\n\nTyped properties become your database schema. Migrations are generated automatically.\n\n```php\n\u003c?php\n\nnamespace App\\Models;\n\nuse BaseApi\\Models\\BaseModel;\n\nclass Product extends BaseModel\n{\n    public string $name = '';\n    public float $price = 0.0;\n    public int $stock = 0;\n    public bool $available = true;\n    \n    public static array $indexes = [\n        'name' =\u003e 'index',\n    ];\n}\n```\n\nRun `./mason migrate:generate` and `./mason migrate:apply`. Done.\n\n### Write a Controller\n\n```php\n\u003c?php\n\nnamespace App\\Controllers;\n\nuse BaseApi\\Controllers\\Controller;\nuse BaseApi\\Http\\JsonResponse;\nuse App\\Models\\Product;\n\nclass ProductController extends Controller\n{\n    public string $name = '';\n    public float $price = 0.0;\n    \n    public function get(): JsonResponse\n    {\n        return JsonResponse::ok(Product::all());\n    }\n    \n    public function post(): JsonResponse\n    {\n        $this-\u003evalidate([\n            'name' =\u003e 'required|string|min:3',\n            'price' =\u003e 'required|numeric|min:0',\n        ]);\n        \n        $product = new Product();\n        $product-\u003ename = $this-\u003ename;\n        $product-\u003eprice = $this-\u003eprice;\n        $product-\u003esave();\n        \n        return JsonResponse::created($product-\u003ejsonSerialize());\n    }\n}\n```\n\n### Add Routes\n\n```php\n\u003c?php\n\nuse BaseApi\\App;\nuse App\\Controllers\\ProductController;\nuse BaseApi\\Http\\Middleware\\RateLimitMiddleware;\n\n$router = App::router();\n\n$router-\u003eget('/products', [ProductController::class]);\n$router-\u003epost('/products', [\n    RateLimitMiddleware::class =\u003e ['limit' =\u003e '10/1m'],\n    ProductController::class,\n]);\n```\n\nThat's it. Your API is ready.\n\n---\n\n## Production-Ready from Day One\n\nBaseAPI v1.0.0 is built for production with everything you need:\n\n**Database \u0026 Migrations**\n- MySQL, PostgreSQL, and SQLite support\n- Automatic migration generation from model definitions\n- Safe migration mode for production deployments\n- Relationship support (belongsTo, hasMany)\n\n**Performance \u0026 Caching**\n- Sub-millisecond framework overhead with compiled route caching\n- O(1) static route lookups via hash map dispatch\n- Segment-based dynamic route matching with zero allocation\n- File and Redis-based caching with tagged invalidation\n- Query result caching\n- Connection pooling\n- Opcache-optimized route compilation\n\n**Security**\n- CORS middleware with configurable allowlists\n- Rate limiting with multiple storage backends\n- Input validation with 20+ built-in rules\n- SQL injection protection via parameterized queries\n- Session and API token authentication\n\n**Developer Experience**\n- Automatic OpenAPI specification generation\n- TypeScript type generation for frontend integration\n- Mason CLI for migrations, code generation, queue management, and route caching\n- Route inspection and performance tools (`route:cache`, `route:list`, `route:clear`)\n- Comprehensive validation with custom rules\n- Built-in file upload handling with security checks\n\n**Async Processing**\n- Queue system with database and sync drivers\n- Job retry logic with exponential backoff\n- Worker management with memory and time limits\n\n**Internationalization**\n- Full i18n support with namespace organization\n- Automatic translation via OpenAI or DeepL\n- Token scanning and management CLI\n\n**AI Integration**\n- OpenAI Responses API wrapper with streaming support\n- Function calling (tools) for AI-powered features\n- Structured JSON output with schema validation\n- Support for reasoning models (o-series)\n\n**Deployment**\n- Environment-based configuration\n- Health check endpoints\n- Docker-ready\n- Supports traditional hosting, VPS, and cloud platforms\n\n---\n\n## Code Quality\n\nBaseAPI maintains high standards with:\n- PHPStan level 7 static analysis\n- Comprehensive test suite across all implemented features\n- Rector for PHP 8.4+ code modernization\n- Pre-commit hooks for syntax, tests, and security\n- Performance benchmarks: 1,350+ req/s, \u003c1ms overhead, 0.8MB/request\n\n---\n\n## Documentation\n\nEverything you need to know:\n\n**[Full Documentation](https://base-api.de)**\n\nTopics covered:\n- Getting started guide\n- Models, migrations, and relationships\n- Controllers, routing, and validation\n- Caching strategies and configuration\n- Queue system and background jobs\n- Authentication and authorization\n- File storage and uploads\n- Internationalization\n- AI integration (OpenAI)\n- Deployment guides\n- API reference\n\n---\n\n## Requirements\n\n- PHP 8.4+\n- Composer\n- MySQL 8.0+, PostgreSQL 13+, or SQLite 3.35+\n- Redis 6.0+ (optional, for caching and queues)\n\n---\n\n## Contributing\n\nWe welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n---\n\n## License\n\nBaseAPI is open-source software licensed under the [MIT license](LICENSE).\n\n---\n\n## Links\n\n- **[Documentation](https://base-api.de)** The full documentation for BaseAPI\n- **[Template Repository](https://github.com/timanthonyalexander/base-api-template)** This is the project you start with when building your own API\n- **[Hotel Comparison Project](https://hotel.timanthonyalexander.de)** This is a Hotel Comparison API + Frontend UI ontop of BaseAPI\n- **[Webshop w/ Stripe Project](https://shop.timanthonyalexander.de)** This is a WebShop API + Frontend UI ontop of BaseAPI\n- **[Flix Movies and Series Website](https://github.com/timanthonyalexander/base-api-flix)** This is a Netflix-like application with movies and series\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimanthonyalexander%2Fbase-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimanthonyalexander%2Fbase-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimanthonyalexander%2Fbase-api/lists"}