{"id":19336470,"url":"https://github.com/prometee/phpclassgenerator","last_synced_at":"2025-10-06T15:14:09.354Z","repository":{"id":57045181,"uuid":"273572030","full_name":"Prometee/PhpClassGenerator","owner":"Prometee","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-05T11:32:19.000Z","size":259,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T06:11:16.170Z","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/Prometee.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-19T19:32:09.000Z","updated_at":"2024-06-05T11:30:57.000Z","dependencies_parsed_at":"2024-06-05T13:11:49.887Z","dependency_job_id":null,"html_url":"https://github.com/Prometee/PhpClassGenerator","commit_stats":{"total_commits":74,"total_committers":1,"mean_commits":74.0,"dds":0.0,"last_synced_commit":"ddb59a1ddb27a5f6508071e045edd2fcc6634b66"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prometee%2FPhpClassGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prometee%2FPhpClassGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prometee%2FPhpClassGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prometee%2FPhpClassGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Prometee","download_url":"https://codeload.github.com/Prometee/PhpClassGenerator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250352165,"owners_count":21416453,"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-10T03:11:14.008Z","updated_at":"2025-10-06T15:14:04.303Z","avatar_url":"https://github.com/Prometee.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Software License][ico-license]](LICENSE)\n[![Build Status][ico-github-actions]][link-github-actions]\n[![Quality Score][ico-code-quality]][link-code-quality]\n\n## PHP8 class generator\n\nThis library generate PHP8 classes.\n\n## Installation\n\nInstall using Composer :\n\n```\n$ composer require prometee/php-class-generator\n```\n\n## Usage\n\nCreate your `PhpGenerator`, an example can be found here :\n\n[DummyPhpGenerator.php](tests/DummyPhpGenerator.php)\n\nThen instantiate :\n\n```php\n$loader = require_once( __DIR__.'/vendor/autoload.php');\n\nuse Doctrine\\Common\\Annotations\\Annotation\\Required;\nuse Prometee\\PhpClassGenerator\\Builder\\ClassBuilder;\nuse Prometee\\PhpClassGenerator\\Builder\\Model\\ModelFactoryBuilder;\nuse Prometee\\PhpClassGenerator\\Builder\\View\\ViewFactoryBuilder;\nuse Prometee\\PhpClassGenerator\\Model\\PhpDoc\\PhpDocInterface;\n\n// Create your own Php Generator\nfinal class MyPhpGenerator implements PhpGeneratorInterface {\n    use PhpGeneratorTrait;\n}\n\n$path = __DIR__ . '/etc/build/Dummy';\n$namespace = 'Tests\\\\Prometee\\\\PhpClassGenerator\\\\Resources';\n$classConfig = [\n    [\n        'class' =\u003e 'MyClass',\n        'type' =\u003e 'final',\n        'extends' =\u003e stdClass::class,\n        'phpdoc' =\u003e [\n            PhpDocInterface::TYPE_DESCRIPTION =\u003e [\n                'My own class description',\n                'with multiple lines',\n            ],\n        ],\n        'properties' =\u003e [\n            [\n                'name' =\u003e 'myProperty',\n                'types' =\u003e [\n                    'null',\n                    $namespace . '\\\\MyClass[]',\n                ],\n                'default' =\u003e null,\n                'description' =\u003e null,\n                'phpdoc' =\u003e [\n                    PhpDocInterface::TYPE_DESCRIPTION =\u003e [\n                        'My description',\n                        'My description line 2',\n                    ],\n                    sprintf('\\\\%s()', Required::class) =\u003e [''] // An annotation\n                ],\n            ],\n        ],\n    ],\n];\n\n$dummyPhpGenerator = new MyPhpGenerator(\n    new ClassBuilder(\n        new ModelFactoryBuilder(),\n        new ViewFactoryBuilder()\n    )\n);\n\n// Configure the generator first\n$dummyPhpGenerator-\u003econfigure(\n    $path,\n    $namespace,\n    $classConfig\n);\n\n// Then generate\n$dummyPhpGenerator-\u003egenerate();\n\n```\n\n## Results example\n\n[tests/Resources](tests/Resources)\n\n\n[ico-version]: https://img.shields.io/packagist/v/Prometee/php-class-generator.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-github-actions]: https://github.com/Prometee/PhpClassGenerator/workflows/Build/badge.svg\n[ico-code-quality]: https://img.shields.io/scrutinizer/g/Prometee/PhpClassGenerator.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/prometee/php-class-generator\n[link-github-actions]: https://github.com/Prometee/PhpClassGenerator/actions?query=workflow%3A\"Build\"\n[link-code-quality]: https://scrutinizer-ci.com/g/Prometee/PhpClassGenerator\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprometee%2Fphpclassgenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprometee%2Fphpclassgenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprometee%2Fphpclassgenerator/lists"}