{"id":37265384,"url":"https://github.com/quellabs/canvas","last_synced_at":"2026-06-01T08:01:04.169Z","repository":{"id":294737190,"uuid":"986130725","full_name":"quellabs/canvas","owner":"quellabs","description":"Modern PHP framework with annotation routing, ObjectQuel ORM, and legacy integration. Modernize existing PHP apps incrementally without breaking what works.","archived":false,"fork":false,"pushed_at":"2026-05-25T11:08:56.000Z","size":1126,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-25T13:09:49.091Z","etag":null,"topics":["dependency-injection","framework","orm","php","php-framework"],"latest_commit_sha":null,"homepage":"http://www.canvasphp.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/quellabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-05-19T06:46:22.000Z","updated_at":"2026-05-25T11:08:58.000Z","dependencies_parsed_at":"2025-06-06T12:27:00.591Z","dependency_job_id":"afee89b1-d794-4334-84c2-096aaf45ab0b","html_url":"https://github.com/quellabs/canvas","commit_stats":null,"previous_names":["quellabs/canvas"],"tags_count":111,"template":false,"template_full_name":null,"purl":"pkg:github/quellabs/canvas","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quellabs%2Fcanvas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quellabs%2Fcanvas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quellabs%2Fcanvas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quellabs%2Fcanvas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quellabs","download_url":"https://codeload.github.com/quellabs/canvas/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quellabs%2Fcanvas/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33765379,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["dependency-injection","framework","orm","php","php-framework"],"created_at":"2026-01-16T00:07:23.322Z","updated_at":"2026-06-01T08:01:04.146Z","avatar_url":"https://github.com/quellabs.png","language":"PHP","funding_links":["https://github.com/sponsors/quellabs"],"categories":[],"sub_categories":[],"readme":"# Canvas\n\n[![Packagist](https://img.shields.io/packagist/v/quellabs/canvas.svg)](https://packagist.org/packages/quellabs/canvas)\n[![PHPStan](https://img.shields.io/badge/PHPStan-level%209-brightgreen.svg)](https://phpstan.org)\n[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)\n\nA PHP framework built for real-world projects — especially the messy ones. Canvas drops into existing PHP codebases without forcing a rewrite, while giving new projects a clean, annotation-driven architecture with aspect-oriented programming and a readable ORM.\n\n## The legacy problem\n\nMost frameworks assume you're starting fresh. Canvas doesn't. Point it at your existing application, and it takes over routing while your old `.php` files keep working:\n\n```php\n// config/app.php\nreturn [\n    'legacy_enabled' =\u003e true,\n    'legacy_path'    =\u003e dirname(__FILE__) . \"/../legacy\"\n];\n```\n\nCanvas checks its own routes first. Unmatched URLs fall through to your legacy files — every existing page keeps working from day one. Your legacy code can immediately use Canvas services:\n\n```php\n// legacy/admin/dashboard.php — your existing file, now with Canvas services\n$users = canvas('EntityManager')-\u003efindBy(User::class, ['active' =\u003e true]);\n```\n\nLegacy files using `header()`, `die()`, and `exit()` are automatically preprocessed to work within Canvas's request/response flow. The preprocessing is recursive — included files are transformed too, and results are cached.\n\nMigrate one route at a time. When a Canvas controller claims a URL, it takes precedence over the legacy file. When every route is migrated, set `legacy_enabled` to `false`.\n\n## Cross-cutting concerns without the mess\n\nHere's what a controller looks like when authentication, caching, and rate limiting are tangled into business logic:\n\n```php\n// The usual approach\npublic function manage() {\n    if (!$this-\u003eauth-\u003eisAuthenticated()) {\n        return redirect('/login');\n    }\n\n    $key = 'users_' . md5(serialize($params));\n    if ($cached = $this-\u003ecache-\u003eget($key)) {\n        return $cached;\n    }\n\n    if ($this-\u003erateLimiter-\u003etooManyAttempts($ip, 100)) {\n        return response('Too many requests', 429);\n    }\n\n    $users = $this-\u003eem()-\u003efindBy(User::class, ['active' =\u003e true]);\n    $result = $this-\u003erender('admin/users.tpl', compact('users'));\n    $this-\u003ecache-\u003eset($key, $result, 300);\n    return $result;\n}\n```\n\nCanvas separates cross-cutting concerns into aspects — reusable classes applied via annotations:\n\n```php\n// Canvas: business logic only, concerns declared as aspects\n/**\n * @Route(\"/admin/users\")\n * @InterceptWith(RequireAuthAspect::class, priority=100)\n * @InterceptWith(CacheAspect::class, ttl=300)\n * @InterceptWith(RateLimitAspect::class, limit=100, window=3600)\n */\npublic function manage() {\n    $users = $this-\u003eem()-\u003efindBy(User::class, ['active' =\u003e true]);\n    return $this-\u003erender('admin/users.tpl', compact('users'));\n}\n```\n\nThree lines of business logic. Authentication, caching, and rate limiting are declared, not coded. Each aspect is a standalone class — `BeforeAspect` for auth checks, `AroundAspect` for caching, `AfterAspect` for logging:\n\n```php\nclass RequireAuthAspect implements BeforeAspect {\n    public function __construct(private AuthService $auth) {}\n\n    public function before(MethodContextInterface $context): ?Response {\n        if (!$this-\u003eauth-\u003eisAuthenticated()) {\n            return new RedirectResponse('/login');\n        }\n        return null; // proceed to method\n    }\n}\n```\n\nAspects inherit through controller hierarchies — apply `@InterceptWith` on a base class and every child controller gets it automatically. Priority ordering controls execution sequence within each inheritance level.\n\n## ObjectQuel ORM\n\nCanvas integrates with [ObjectQuel](https://objectquel.com) through the `quellabs/canvas-objectquel` package. Simple lookups use familiar `find` and `findBy` methods. Complex queries use ObjectQuel's declarative syntax:\n\n```php\n$results = $this-\u003eem()-\u003eexecuteQuery(\"\n    range of p is App\\\\Entity\\\\Post\n    range of u is App\\\\Entity\\\\User via p.authorId\n    retrieve (p, u.name) where p.title = /^Tech/i\n    sort by p.publishedAt desc\n    window 0 using window_size 20\n\");\n```\n\nPattern matching, regex, full-text search, and relationship traversal are first-class query expressions — not raw SQL escapes. ObjectQuel can also join database entities with JSON files in a single query via `json_source()`, something no other PHP ORM supports.\n\n## How to Install\n\n```bash\n# New project\ncomposer create-project quellabs/canvas-skeleton my-app\n\n# Existing project\ncomposer require quellabs/canvas\n```\n\n## Quick start\n\n```php\nclass BlogController extends BaseController {\n\n    /**\n     * @Route(\"/posts/{id:int}\")\n     */\n    public function show(int $id) {\n        $post = $this-\u003eem()-\u003efind(Post::class, $id);\n        return $this-\u003erender('post.tpl', compact('post'));\n    }\n}\n```\n\nControllers are discovered automatically through Composer metadata. Routes are defined with annotations. Typed route parameters (`{id:int}`) are validated before your method runs. No configuration files, no route registration.\n\nCanvas uses [Smarty](https://www.smarty.net/) as its default template engine. Twig support is available through a separate package.\n\n## Features\n\n- **Legacy-first integration** — wrap existing PHP apps with route fallthrough, automatic preprocessing of `header()`/`die()`/`exit()`, and a `canvas()` helper for accessing services from legacy code\n- **Aspect-oriented programming** — Before, Around, and After aspects with annotation parameters, priority ordering, and inheritance through controller hierarchies\n- **ObjectQuel ORM** — declarative query language with pattern matching, hybrid JSON sources, and Data Mapper architecture\n- **Contextual dependency injection** — resolve different interface implementations based on request context, without conditional logic in your code\n- **Signal/slot event system** — Qt-style decoupled service communication with type checking and priority-based handlers\n- **Task scheduling** — cron-style background jobs with timeouts and concurrent execution handling\n- **Validation \u0026 sanitization** — declarative rules applied as aspects, keeping controllers clean\n- **Visual inspector** — debug bar with database queries, request analysis, and custom panels\n- **CLI tooling** — route listing, route matching, task management, asset publishing, entity generation\n\n## Documentation\n\nFull docs, guides, and API reference: **[canvasphp.com/docs](https://canvasphp.com/docs)**\n\n## Contributing\n\nBug reports and feature requests via GitHub issues. PRs welcome — fork, branch, follow PSR-12, add tests.\n\n## Support\n\nIf Canvas saves you time, consider [sponsoring development](https://github.com/sponsors/quellabs).\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquellabs%2Fcanvas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquellabs%2Fcanvas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquellabs%2Fcanvas/lists"}