{"id":20238223,"url":"https://github.com/basilfx/phalcon-modelgen","last_synced_at":"2026-05-08T22:03:06.838Z","repository":{"id":145221097,"uuid":"84797948","full_name":"basilfx/Phalcon-ModelGen","owner":"basilfx","description":"Generate models using an extended set of model annotations.","archived":false,"fork":false,"pushed_at":"2017-03-13T07:48:16.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-14T01:14:26.532Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/basilfx.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}},"created_at":"2017-03-13T07:44:29.000Z","updated_at":"2019-01-30T12:30:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"c1722068-8c1b-464b-9da8-6acaf5d27403","html_url":"https://github.com/basilfx/Phalcon-ModelGen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basilfx%2FPhalcon-ModelGen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basilfx%2FPhalcon-ModelGen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basilfx%2FPhalcon-ModelGen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basilfx%2FPhalcon-ModelGen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/basilfx","download_url":"https://codeload.github.com/basilfx/Phalcon-ModelGen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241685492,"owners_count":20003101,"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-11-14T08:32:27.765Z","updated_at":"2025-11-30T06:03:15.367Z","avatar_url":"https://github.com/basilfx.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Phalcon-ModelGen\nGenerate models using an extended set of model annotations.\n\n## Introduction\nThe Phalcom Framework ORM system is powerful, but it requires a lot of boilerplate to achieve more advanced functions. Furthermore, it does not work with high-level objects such as DateTime instances, or JSON objects.\n\nUsing ModelGen, we can generate the boilerplate code based on a minimal model specification. See the [Examples](examples/README.md) folder for a few model examples.\n\nModels will be stored as PHP files on disk. No magic methods are used, so expect a small performance advantage over traditional models. Models do not depend on any runtime.\n\n## Requirements\n* PHP 7.0 or later.\n* Phalcon Framework 3.0 or later.\n\n## Installation\nInstall this dependency using `composer require basilfx/phalcon-modelgen`.\n\n### Mode of operation.\nThis library will intercept file includes, and compile ModelGen annotated files before they are used. This is accomplished by using stream wrappers.\n\nWithin you loader configuration, you have to declare the folder where your models reside.\n\n```php\n\u003c?php\n\nuse Phalcon\\Loader;\n\n$loader = new Loader();\n\n$loader-\u003eregisterNamespaces([\n    // ...\n    \"My\\\\Models\\\\Base\" =\u003e \"modelgen://\" . APP_DIR . \"models/Base/\",\n    // ...\n]);\n```\n\nWhenever you refer to a model in the `My\\Models` namespace, the compiled version is used.\n\nNext, it is important to register the stream wrapper.\n\n```\n\u003c?php\n\nuse BasilFX\\ModelGen\\Compiler as ModelGenCompiler;\n\n$modelGen = new ModelGenCompiler();\n\n$modelGen-\u003esetCacheDirectory($config-\u003ecacheDir . \"modelgen/\");\n$modelGen-\u003eregisterAsStream();\n```\n\n### Performance\nBy default, ModelGen will re-compile all the files on every request. This is slow, but useful for development. You can configure this behaviour.\n\n```php\n\u003c?php\n/// ...\n$modelGen-\u003esetCompileAlways($config-\u003edebug \u0026 $config-\u003eadvanced-\u003edebug-\u003emodelGen);\n// ...\n```\n\nNote that you have to clear your cache folder if your models have changed.\n\n## License\nSee the `LICENSE` file (MIT license).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasilfx%2Fphalcon-modelgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasilfx%2Fphalcon-modelgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasilfx%2Fphalcon-modelgen/lists"}