{"id":15527424,"url":"https://github.com/tomasvotruba/lines","last_synced_at":"2025-10-07T03:56:33.519Z","repository":{"id":184021334,"uuid":"671070457","full_name":"TomasVotruba/lines","owner":"TomasVotruba","description":"CLI tool for quick size measure of PHP project, runs anywhere","archived":false,"fork":false,"pushed_at":"2025-09-25T12:22:09.000Z","size":22361,"stargazers_count":169,"open_issues_count":1,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-09-25T12:27:10.199Z","etag":null,"topics":["lines-of-code","measure","php","size"],"latest_commit_sha":null,"homepage":"https://tomasvotruba.com/blog/easy-and-quick-way-to-measure-lines-of-code-in-php","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/TomasVotruba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"tomasvotruba","custom":"https://www.paypal.me/rectorphp"}},"created_at":"2023-07-26T13:25:04.000Z","updated_at":"2025-09-25T12:21:59.000Z","dependencies_parsed_at":"2023-12-15T11:23:35.278Z","dependency_job_id":"8dd87c7e-a49d-47c1-83a1-2e38fdeb620a","html_url":"https://github.com/TomasVotruba/lines","commit_stats":{"total_commits":37,"total_committers":3,"mean_commits":"12.333333333333334","dds":0.05405405405405406,"last_synced_commit":"296673740eef9abd541cb08ef5b6f6f1bee52dc9"},"previous_names":["tomasvotruba/lines"],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/TomasVotruba/lines","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomasVotruba%2Flines","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomasVotruba%2Flines/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomasVotruba%2Flines/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomasVotruba%2Flines/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TomasVotruba","download_url":"https://codeload.github.com/TomasVotruba/lines/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomasVotruba%2Flines/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278717446,"owners_count":26033542,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["lines-of-code","measure","php","size"],"created_at":"2024-10-02T11:06:15.689Z","updated_at":"2025-10-07T03:56:33.514Z","avatar_url":"https://github.com/TomasVotruba.png","language":"PHP","funding_links":["https://github.com/sponsors/tomasvotruba","https://www.paypal.me/rectorphp"],"categories":[],"sub_categories":[],"readme":"# Lines of code\n\nCLI tool for quick size measure of PHP project, runs anywhere\n\n## What are killer features?\n\n* install anywhere - PHP 7.2? PHPUnit 6? Symfony 3? Not a problem, this package **has zero dependencies and works on PHP 7.2+**\n* get quick overview of your project size - no details, no complexity, just lines of code\n* get easy JSON output for further processing\n* we keep it simple, so you can enjoy reading - for more complex operation use static analysis like PHPStan\n\n\u003cbr\u003e\n\n## Install\n\nThe package is scoped and downgraded to PHP 7.2. So you can install it anywhere with any set of dependencies:\n\n```bash\ncomposer require tomasvotruba/lines --dev\n```\n\n## Usage\n\n```bash\nvendor/bin/lines\n```\n\nBy default, we measure the root directory. To narrow it down, provide explicit path:\n\n```bash\nvendor/bin/lines src\n```\n\nFor short output:\n\n```bash\nvendor/bin/lines --short\n```\n\nFor json output, just add `--json`:\n\n```bash\nvendor/bin/lines --json\n```\n\nAlso, you can combine them (very handy for blog posts and tweets):\n\n```bash\nvendor/bin/lines --short --json\n```\n\n\u003cbr\u003e\n\nAre you looking for top 10 longest files?\n\n```bash\nvendor/bin/lines --longest\n```\n\n↓\n\n```bash\n  Longest files                                 line count\n  src/Measurements.php ............................... 320\n  src/Console/OutputFormatter/TextOutputFormatter.php  136\n  src/NodeVisitor/StructureNodeVisitor.php ........... 124\n  src/Console/Command/MeasureCommand.php .............. 98\n  src/Analyser.php .................................... 92\n  src/DependencyInjection/ContainerFactory.php ........ 81\n  src/Console/OutputFormatter/JsonOutputFormatter.php . 70\n  src/Finder/PhpFilesFinder.php ....................... 56\n  src/ValueObject/TableView.php ....................... 54\n  src/ValueObject/TableRow.php ........................ 40\n```\n\n\u003cbr\u003e\n\n## The Measured Items\n\nFor the text output, you'll get data like these:\n\n```bash\n  Filesystem                                         count\n  Directories ......................................... 32\n  Files .............................................. 160\n\n  Lines of code                           count / relative\n  Code ................................... 15 521 / 70.9 %\n  Comments ................................ 6 372 / 29.1 %\n  Total .................................. 21 893 /  100 %\n\n  Structure                                          count\n  Namespaces .......................................... 32\n  Classes ............................................ 134\n   * Constants ........................................ 91\n   * Methods ....................................... 1 114\n  Interfaces .......................................... 20\n  Traits ............................................... 4\n  Enums ................................................ 1\n  Functions ........................................... 36\n  Global constants ..................................... 0\n\n  Methods                                 count / relative\n  Non-static .............................. 1 058 /   95 %\n  Static ..................................... 56 /    5 %\n\n  Public .................................... 875 / 78.5 %\n  Protected .................................. 90 /  8.1 %\n  Private ................................... 149 / 13.4 %\n```\n\nOr in a json format:\n\n```json\n{\n    \"filesystem\": {\n        \"directories\": 10,\n        \"files\": 15\n    },\n    \"lines_of_code\": {\n        \"code\": 1064,\n        \"code_relative\": 95.4,\n        \"comments\": 51,\n        \"comments_relative\": 4.6,\n        \"total\": 1115\n    },\n    \"structure\": {\n        \"namespaces\": 11,\n        \"classes\": 14,\n        \"class_methods\": 88,\n        \"class_constants\": 0,\n        \"interfaces\": 1,\n        \"traits\": 0,\n        \"enums\": 0,\n        \"functions\": 5,\n        \"global_constants\": 3\n    },\n    \"methods_access\": {\n        \"non_static\": 82,\n        \"non_static_relative\": 93.2,\n        \"static\": 6,\n        \"static_relative\": 6.8\n    },\n    \"methods_visibility\": {\n        \"public\": 70,\n        \"public_relative\": 79.5,\n        \"protected\": 2,\n        \"protected_relative\": 2.3,\n        \"private\": 16,\n        \"private_relative\": 18.2\n    }\n}\n```\n\n\n## Vendor file scanning\n\nThis tool use case is to measure your code, not the 3rd party libraries. That's why it ignores `/vendor` directory by default to avoid huge false positives.\n\nIf you want to measure vendor files too, use `--allow-vendor` option:\n\n```bash\n vendor/bin/lines vendor/rector/rector --allow-vendor\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomasvotruba%2Flines","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomasvotruba%2Flines","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomasvotruba%2Flines/lists"}