{"id":22864099,"url":"https://github.com/statix-php/tailor","last_synced_at":"2026-02-10T15:50:30.882Z","repository":{"id":264551187,"uuid":"893652348","full_name":"statix-php/tailor","owner":"statix-php","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-13T05:31:39.000Z","size":316,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-04T05:49:28.567Z","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/statix-php.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":"2024-11-25T00:44:02.000Z","updated_at":"2025-01-13T05:31:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"6a6a5fa4-ef0f-4b71-bd52-4e9826959ff5","html_url":"https://github.com/statix-php/tailor","commit_stats":null,"previous_names":["statix-php/tailor"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statix-php%2Ftailor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statix-php%2Ftailor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statix-php%2Ftailor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statix-php%2Ftailor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/statix-php","download_url":"https://codeload.github.com/statix-php/tailor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252293132,"owners_count":21724962,"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-12-13T11:19:08.052Z","updated_at":"2026-02-10T15:50:30.835Z","avatar_url":"https://github.com/statix-php.png","language":"PHP","readme":"![Statix](./.art/banner.png)\n\n# _Tailor_ for Laravel Blade\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/statix/tailor.svg?style=flat-square)](https://packagist.org/packages/statix/tailor)\n[![Packagist Downloads](https://img.shields.io/packagist/dt/statix/tailor.svg?style=flat-square)](https://packagist.org/packages/statix/tailor)\n\nA _neat_ package to help build Blade component libraries.\n\n## Installation\n\n```bash\ncomposer require statix/tailor\n```\n\n## Configuration\n\nPublishing the configuration file is optional.\n\n```bash\nphp artisan vendor:publish --tag=tailor-config\n```\n\n## Usage\n\n### Building a Component\n\n```blade\n// view/components/button.blade.php\n\n@props([\n    'variant' =\u003e 'primary',\n    'size' =\u003e 'md'\n    'type' =\u003e 'button',\n    'tag' =\u003e 'button',\n])\n\n@php\n// create the tailor\n$c = Tailor::make('button');\n\n// start setting up the attributes\n$c-\u003eattributes()\n    -\u003eset([\n        'data-variant' =\u003e $variant,\n        'data-size' =\u003e $size,\n    ])-\u003eif($tag !== 'button', function ($set) use ($type) {\n        $set('type', $type);\n        $set('aria-role', 'button');\n    })-\u003eif($tag === 'a', function ($set) {\n        $set('aria-role', 'link');\n    });\n\n// start building the variants\n$c-\u003evariant('primary');\n$c-\u003evariant('secondary');\n\n// start building the classes common to all variants\n$c-\u003eclasses()\n    -\u003ebase([\n        'rounded-md',\n        'border',\n    ])-\u003efocus([\n        'focus:ring-2',\n        'focus-visible:outline-offset-2',\n    ])-\u003ematch($size, [\n        'sm' =\u003e 'px-2 py-1',\n        'md' =\u003e 'px-3 py-2',\n        'lg' =\u003e 'px-4 py-3',\n        'xl' =\u003e 'px-5 py-4',\n        'default' =\u003e $size,\n    ]);\n\n// start building the classes for the primary variant\n$p = $c-\u003evariant('primary');\n\n$p-\u003eclasses()\n    -\u003elight([\n        'bg-indigo-600',\n    ])-\u003ehoverLight([\n        'hover:bg-indigo-500',\n    ])-\u003efocusLight([\n        'focus-visible:outline-indigo-600',\n    ])-\u003edark([\n        'dark:text-white',\n        'dark:bg-indigo-700',\n    ]);\n\n// start building the classes for the secondary variant\n$s = $c-\u003evariant('secondary');\n\n$s-\u003eclasses()\n    -\u003elight([\n        'bg-gray-200',\n    ])-\u003ehoverLight([\n        'hover:bg-gray-300',\n    ])-\u003efocusLight([\n        'focus-visible:outline-gray-200',\n    ])-\u003edark([\n        'dark:text-gray-200',\n        'dark:bg-gray-700',\n    ])-\u003efocusDark([\n        'focus-visible:outline-gray-200',\n    ]);\n\n// merge the attributes and classes with the passed attributes\n$c-\u003eattributes()-\u003emerge($attributes-\u003egetAttributes());\n$c-\u003eclasses()-\u003emerge($attributes-\u003eget('class', ''));\n\n// set the variant to use\n$c-\u003esetVariant($variant);\n\n// now when we output the component, the classes\n// and attributes will be applied, specific to the variant\n\n$c-\u003eattributes()\n    -\u003eset('onclick', 'alert(\"Hello\")')\n    -\u003eset('onDblClick', '$wire.emit(\"dblClick\")');\n@endphp\n\n\u003c{{ $tag }} {{ $c }}\u003e{{ $slot}}\u003c{{ $tag }}\u003e\n```\n\n### Using the Component\n\n```blade\n\u003cx-button variant=\"primary\" size=\"md\" type=\"button\" class=\"my-2\"\u003e\n    Click Me\n\u003c/x-button\u003e\n\n\u003cx-button variant=\"secondary\" size=\"px-6 py-2\" tag=\"a\" href=\"#\"\u003e\n    A link button\n\u003c/x-button\u003e\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatix-php%2Ftailor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstatix-php%2Ftailor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatix-php%2Ftailor/lists"}