{"id":16954874,"url":"https://github.com/irazasyed/docgen","last_synced_at":"2025-03-22T13:31:52.419Z","repository":{"id":143005627,"uuid":"614623839","full_name":"irazasyed/docgen","owner":"irazasyed","description":"📖 Streamline your Laravel package development with automatic facade documentation using Docgen for Laravel.","archived":false,"fork":false,"pushed_at":"2024-03-25T09:26:49.000Z","size":56,"stargazers_count":20,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-03T03:54:37.950Z","etag":null,"topics":["docgen","laravel","laravel-facade","laravel-package","package-development","phpdoc","phpdocumentor"],"latest_commit_sha":null,"homepage":"","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/irazasyed.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-03-16T01:09:19.000Z","updated_at":"2024-04-15T10:53:36.383Z","dependencies_parsed_at":"2023-11-14T07:27:39.948Z","dependency_job_id":"14e53e5e-3081-45a5-84a0-84869aa9a58f","html_url":"https://github.com/irazasyed/docgen","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irazasyed%2Fdocgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irazasyed%2Fdocgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irazasyed%2Fdocgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irazasyed%2Fdocgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/irazasyed","download_url":"https://codeload.github.com/irazasyed/docgen/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244216062,"owners_count":20417545,"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":["docgen","laravel","laravel-facade","laravel-package","package-development","phpdoc","phpdocumentor"],"created_at":"2024-10-13T22:10:47.955Z","updated_at":"2025-03-22T13:31:47.408Z","avatar_url":"https://github.com/irazasyed.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docgen for Laravel Facade\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/irazasyed/docgen.svg?style=flat-square)](https://packagist.org/packages/irazasyed/docgen)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/irazasyed/docgen/ci.yml?branch=main\u0026label=tests\u0026style=flat-square)](https://github.com/irazasyed/docgen/actions?query=workflow%3Aci+branch%3Amain)\n[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/irazasyed/docgen/code-style.yml?branch=main\u0026label=code%20style\u0026style=flat-square)](https://github.com/irazasyed/docgen/actions?query=workflow%3A\"Code+Style\"+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/irazasyed/docgen.svg?style=flat-square)](https://packagist.org/packages/irazasyed/docgen)\n\n\u003e 📖 Streamline your Laravel package development with automatic facade documentation using Docgen for Laravel Facade.\n\n![Docgen](https://user-images.githubusercontent.com/1915268/225490242-13903347-b8a7-40ea-897b-0a5429208cbb.jpg)\n\n## Introduction\n\nDocgen for Laravel packages, the ultimate solution for Laravel package developers.\n\nThis heroic package automatically generates documentation for your Laravel package facade, eliminating the tedious task of maintaining it yourself.\n\nWith this package, IDEs will provide you and the developers using your package with method suggestions, making your development journey a breeze.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require irazasyed/docgen --dev\n```\n\n## Usage\n\nThere are a number of ways to use the CLI tool.\n\n### Basic\n\nLet's start with the basic usage.\n\nCall the command with the name of the facade:\n\n```bash\nvendor/bin/docgen -f \"Namespace\\Path\\To\\Laravel\\Facade::class\"\n```\n\n### Advanced\n\nCreate a new config file in your package's root directory named `docgen.php` and add the following code:\n\n```php\n\u003c?php\n\nreturn [\n    'facade' =\u003e Namespace\\Path\\To\\Laravel\\Facade::class,\n\n    // Optional\n    // Path\\To\\Class::class =\u003e [Excluded Methods Array]\n    'classes' =\u003e [],\n    \n    // Global Excluded Methods\n    'excludedMethods' =\u003e [],\n];\n```\n\nRun the following command to generate the documentation and apply it to the facade:\n\n```bash\nvendor/bin/docgen\n```\n\nYou can also store the config file elsewhere and provide the path using the `-c` or `--config` option.\n\nExample:\n\n```bash\nvendor/bin/docgen -c path/to/docgen.php\n```\n#### Generate Docs for Multiclass Facade\n\nIf your Laravel facade is linked to a chain of classes that require documentation, you can provide an array of class names. Additionally, if you want to exclude certain methods from the documentation of a specific class, you can pass an array containing the names of those methods.\n\nTo illustrate, consider the following example which demonstrates how to use this approach with the Telegram Bot SDK's Laravel Facade:\n\n```php\n\u003c?php\n\n// docgen.php\n\nreturn [\n    'facade' =\u003e Telegram\\Bot\\Laravel\\Facades\\Telegram::class,\n    \n    'classes' =\u003e [\n        \\Telegram\\Bot\\BotsManager::class,\n        \\Telegram\\Bot\\Api::class =\u003e [\n            'setContainer',\n            'getWebhookUpdates',\n        ],\n        \\Telegram\\Bot\\Commands\\CommandBus::class =\u003e [\n            'getTelegram',\n            'setTelegram',\n        ],\n    ],\n    \n    // Global Excluded Methods\n    'excludedMethods' =\u003e [],\n];\n```\n\nCall the command to generate and apply the docs.\n\n```bash\nvendor/bin/docgen\n```\n\n## API\n\n### `generate(string|array $classes, array $globalExcludedMethods = [])`\n\nGenerate the documentation for given classes.\n\n#### Parameters\n\n- `$classes` - The class name or an array of `[class =\u003e (optional) [excluded methods]]` to generate documentation using its methods.\n- `$globalExcludedMethods` - (optional) An array of methods to be excluded when generating docs.\n\n#### Returns\n\n`Docgen` - The Docgen instance.\n\n#### Example\n\n```php\nDocgen::generate([\n    //  Class Name =\u003e [Excluded Methods]\n    \\App\\Some\\Class::class =\u003e ['method1', 'method2'],\n    \\App\\Some\\OtherClass::class,\n])-\u003eapply(\\Namespace\\To\\Facade::class); // Apply to Facade.\n```\n\n### `getDocBlock()`\n\nGet the generated documentation.\n\n#### Returns\n\n`string` - The generated documentation.\n\n### `apply(string $className = '')`\n\nApply the generated documentation to the given class name or defaults to the class used to generate docs.\n\n#### Parameters\n\n- `$className` - (optional) The class name to apply the generated documentation to.\n\n#### Returns\n\n`bool` - True if it was successful, false otherwise.\n\n## TODO\n\n- [ ] Add github action to automatically maintain docs.\n\n## Resources\n\n- [Tutorial: How to Resolve Method Not Found Warnings in Laravel Packages using Docgen](https://dev.to/irazasyed/tutorial-how-to-resolve-method-not-found-warnings-in-laravel-packages-using-docgen-2766)\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Irfaq Syed](https://github.com/irazasyed)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firazasyed%2Fdocgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firazasyed%2Fdocgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firazasyed%2Fdocgen/lists"}