{"id":29745958,"url":"https://github.com/lemmon/clsx-php","last_synced_at":"2025-07-26T06:33:31.803Z","repository":{"id":306016381,"uuid":"1022919285","full_name":"lemmon/clsx-php","owner":"lemmon","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-23T07:14:44.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-23T08:10:40.283Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lemmon.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,"zenodo":null}},"created_at":"2025-07-20T06:07:36.000Z","updated_at":"2025-07-20T06:11:09.000Z","dependencies_parsed_at":"2025-07-23T08:10:42.663Z","dependency_job_id":"3a2110ea-7d1a-4192-890c-4905e54331c2","html_url":"https://github.com/lemmon/clsx-php","commit_stats":null,"previous_names":["lemmon/clsx-php"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lemmon/clsx-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemmon%2Fclsx-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemmon%2Fclsx-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemmon%2Fclsx-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemmon%2Fclsx-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lemmon","download_url":"https://codeload.github.com/lemmon/clsx-php/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemmon%2Fclsx-php/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267130228,"owners_count":24040414,"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-07-26T02:00:08.937Z","response_time":62,"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":[],"created_at":"2025-07-26T06:33:27.047Z","updated_at":"2025-07-26T06:33:31.790Z","avatar_url":"https://github.com/lemmon.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clsx.php\n\n\u003e A tiny PHP utility to conditionally build `class` attribute strings.\n\u003e Inspired by [clsx for JavaScript](https://github.com/lukeed/clsx), it lets you easily compose class names using strings, arrays, and associative arrays.\n\n---\n\n## Installation\n\nInstall via Composer:\n\n```bash\ncomposer require lemmon/clsx\n```\n\n---\n\n## Usage\n\n```php\necho clsx('foo', true \u0026\u0026 'bar', 'baz');\n// Output: 'foo bar baz'\n\necho clsx(['foo', 0, false, 'bar']);\n// Output: 'foo bar'\n\necho clsx(['foo'], ['', 0, false, 'bar'], [['baz', [['hello'], 'there']]], 'bye');\n// Output: 'foo bar baz hello there bye'\n\necho clsx(['foo' =\u003e true, 'bar' =\u003e false, 'baz' =\u003e isSomethingTrue()]);\n// Output: 'foo baz'\n\necho clsx(['foo' =\u003e true], ['--special' =\u003e 'active']);\n// Output: 'foo --special'\n```\n\n---\n\n## API\n\n### `clsx(...$args): string`\n\nReturns a space-separated string of valid class names.\n\n#### Parameters\n\n- `...$args`: mixed\n  Accepts any number of arguments. Arguments can be:\n  - Strings\n  - Arrays (flat or nested)\n  - Associative arrays (keys are class names, values are booleans or strings)\n\n\u003e **Note:** Falsy values like `false`, `null`, `0`, `''`, etc. are discarded.\n\u003e Only truthy values or valid strings are included in the final result.\n\n#### Example\n\n```php\nclsx(true, false, '', null, 0);\n// Output: ''\n```\n\n---\n\n## License\n\nMIT \u0026copy; [Jakub Pelák](https://www.jakubpelak.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemmon%2Fclsx-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flemmon%2Fclsx-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemmon%2Fclsx-php/lists"}