{"id":17226775,"url":"https://github.com/fvsch/kirby4-default-model-loading","last_synced_at":"2025-10-04T08:45:33.390Z","repository":{"id":207912967,"uuid":"720405043","full_name":"fvsch/kirby4-default-model-loading","owner":"fvsch","description":"Reproduction for an issue (or feature request) with Kirby 4","archived":false,"fork":false,"pushed_at":"2024-08-19T16:09:29.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T15:44:21.933Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/fvsch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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}},"created_at":"2023-11-18T11:40:29.000Z","updated_at":"2024-08-19T16:11:33.000Z","dependencies_parsed_at":"2024-12-03T14:23:00.832Z","dependency_job_id":"3958821d-7a30-4a3f-a5fa-7f3924e0fbae","html_url":"https://github.com/fvsch/kirby4-default-model-loading","commit_stats":null,"previous_names":["fvsch/kirby4-default-model-loading"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvsch%2Fkirby4-default-model-loading","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvsch%2Fkirby4-default-model-loading/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvsch%2Fkirby4-default-model-loading/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvsch%2Fkirby4-default-model-loading/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fvsch","download_url":"https://codeload.github.com/fvsch/kirby4-default-model-loading/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245515035,"owners_count":20628093,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-15T04:17:12.815Z","updated_at":"2025-10-04T08:45:28.368Z","avatar_url":"https://github.com/fvsch.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kirby 4 issue with using the DefaultPage model class\n\n## Context\n\nKirby CMS 4 introduces a new optional `DefaultPage` page model class in `site/models/default.php`:\n\nhttps://getkirby.com/releases/4.0/default-page-model\n\nThis model is used when a page type doesn't have a matching model, e.g. a page of type `article` without a matching `ArticlePage` class in `site/models/article.php`.\n\nAn issue arises when one wants to create a specific page model that _extends_ the `DefaultPage` model:\n\n```php\n\u003c?php // site/models/product.php\n\nclass ProductPage extends DefaultPage {\n\t// …\n}\n```\n\nIn that case, chances are Kirby will not have included `site/models/default.php`, and PHP encounters a fatal error:\n\n\u003e Uncaught Error: Class \"DefaultPage\" not found in site/models/aaa.php:3\n\n## Steps to reproduce\n\n1. Download this repository\n2. Install dependencies with composer: `composer install`\n3. Run the PHP dev server with `composer run dev` (uses port `8000`, you can change it in `composer.json`)\n4. Open the resulting site (`http://localhost:8000` by default).\n\nYou should see the `Class \"DefaultPage\" not found` error.\n\nYou can enable a workaround that registers a class autoloading function with `spl_autoload_register`, by running the dev server with:\n\n```sh\nKIRBY_AUTOLOAD_MODELS=true composer run dev\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffvsch%2Fkirby4-default-model-loading","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffvsch%2Fkirby4-default-model-loading","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffvsch%2Fkirby4-default-model-loading/lists"}