{"id":18794557,"url":"https://github.com/effectra/generator","last_synced_at":"2025-12-29T18:30:13.336Z","repository":{"id":168965454,"uuid":"644808486","full_name":"effectra/generator","owner":"effectra","description":"The Effectra/Generator package provides a set of tools for generating PHP class files and configuration files.","archived":false,"fork":false,"pushed_at":"2023-08-13T21:17:24.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-12-29T16:34:04.194Z","etag":null,"topics":["config-file","generate-classes","generate-code","generate-config-file","generate-file","generator","php","template"],"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/effectra.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-05-24T09:51:16.000Z","updated_at":"2023-05-24T10:03:39.000Z","dependencies_parsed_at":"2024-11-07T21:32:12.865Z","dependency_job_id":"4582a92f-89af-46ea-98ec-3f4070bc7a54","html_url":"https://github.com/effectra/generator","commit_stats":null,"previous_names":["effectra/generator"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effectra%2Fgenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effectra%2Fgenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effectra%2Fgenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effectra%2Fgenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/effectra","download_url":"https://codeload.github.com/effectra/generator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239718692,"owners_count":19685795,"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":["config-file","generate-classes","generate-code","generate-config-file","generate-file","generator","php","template"],"created_at":"2024-11-07T21:29:46.503Z","updated_at":"2025-12-29T18:30:13.254Z","avatar_url":"https://github.com/effectra.png","language":"PHP","readme":"# Effectra\\Generator\n\nThe Effectra\\Generator package provides a set of tools for generating PHP class files and configuration files.\n\n## Installation\n\nYou can install the package via Composer:\n\n```bash\ncomposer require effectra/generator\n```\n\n## Usage\n\n### Generate Class\n\nTo generate a PHP class file using the GeneratorClass class, follow these steps:\n\n1. Create an instance of the Creator class:\n\n```php\n$creator = new Creator();\n```\n\n2. Create an instance of the GeneratorClass class, providing the creator and the desired class name:\n\n```php\n$generator = new GeneratorClass($creator, 'MyClass');\n```\n\n3. Customize the class by adding properties, methods, and other elements using the available methods provided by the GeneratorClass and Creator classes.\n\n4. Generate the PHP code for the class:\n\n```php\n$template = $generator-\u003egenerate();\n```\n\n5. Save the generated code to a file:\n\n```php\n$template-\u003esave('/path/to/MyClass.php');\n```\n\n### Generate Config File\n\nTo generate a configuration file using the GeneratorConfigFile class, follow these steps:\n\n1. Create an instance of the Creator class:\n\n```php\n$creator = new Creator();\n```\n\n2. Create an instance of the GeneratorConfigFile class, providing the creator and the ConfigFile instance:\n\n```php\n$configFile = new ConfigFile('/path/to/config.php');\n$generator = new GeneratorConfigFile($creator, $configFile);\n```\n\n3. Generate a new section in the configuration file:\n\n```php\n$section = 'database';\n$config = [\n    'driver' =\u003e 'mysql',\n    'host' =\u003e 'localhost',\n    'database' =\u003e 'mydatabase',\n    'username' =\u003e 'myusername',\n    'password' =\u003e 'mypassword',\n];\n\n$template = $generator-\u003ecreateSection($section, $config);\n```\n\n4. Save the updated configuration file:\n\n```php\n$template-\u003esave('/path/to/config.php');\n```\n\n## Contributing\n\nContributions are welcome! If you find any issues or would like to suggest new features, please open an issue on the [GitHub repository](https://github.com/effectra/generator).\n\n## License\n\nThis package is open-source software licensed under the [MIT license](https://opensource.org/licenses/MIT).\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feffectra%2Fgenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feffectra%2Fgenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feffectra%2Fgenerator/lists"}