{"id":22278040,"url":"https://github.com/enflow/laravel-svg","last_synced_at":"2026-04-07T17:31:28.961Z","repository":{"id":44537742,"uuid":"248780502","full_name":"enflow/laravel-svg","owner":"enflow","description":"Using SVGs with easy","archived":false,"fork":false,"pushed_at":"2026-03-16T14:30:23.000Z","size":128,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-03-17T02:06:21.286Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/enflow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","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":{"custom":"https://enflow.nl/contact"}},"created_at":"2020-03-20T14:50:30.000Z","updated_at":"2026-03-16T14:30:22.000Z","dependencies_parsed_at":"2023-12-25T19:51:41.521Z","dependency_job_id":"6c2fd82e-0ada-48c6-a43b-442725e96935","html_url":"https://github.com/enflow/laravel-svg","commit_stats":{"total_commits":48,"total_committers":3,"mean_commits":16.0,"dds":0.04166666666666663,"last_synced_commit":"9f34956f0722b470aad1afca770868e9bac75245"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/enflow/laravel-svg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enflow%2Flaravel-svg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enflow%2Flaravel-svg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enflow%2Flaravel-svg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enflow%2Flaravel-svg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/enflow","download_url":"https://codeload.github.com/enflow/laravel-svg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enflow%2Flaravel-svg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31522225,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2024-12-03T15:12:40.923Z","updated_at":"2026-04-07T17:31:28.940Z","avatar_url":"https://github.com/enflow.png","language":"PHP","funding_links":["https://enflow.nl/contact"],"categories":[],"sub_categories":[],"readme":"# Using SVGs with easy\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/enflow/laravel-svg.svg?style=flat-square)](https://packagist.org/packages/enflow/laravel-svg)\n![GitHub Workflow Status](https://github.com/enflow-nl/laravel-svg/workflows/run-tests/badge.svg)\n[![Total Downloads](https://img.shields.io/packagist/dt/enflow/laravel-svg.svg?style=flat-square)](https://packagist.org/packages/enflow/laravel-svg)\n\nThe `enflow/laravel-svg` package provides a easy way include SVGs in your templates.\n\n## Installation\nYou can install the package via composer:\n\n``` bash\ncomposer require enflow/laravel-svg\n```\n\n## Usage\nYou may use the `svg` helper in your templates\n\n```blade\n{{ svg('clock') }}\n\n// Adding a class\n{{ svg('clock')-\u003eclass('mr-2') }}\n\n// Adding an extra attribute\n{{ svg('clock')-\u003eclass('mr-2')-\u003eid('clock-icon') }}\n\n// Specify the pack\n{{ svg('clock')-\u003epack('fas') }}\n```\n\n## Config\n\nYou may publish the config to set the packs that you are using:\n\nPushing the config file:\n``` bash\nphp artisan vendor:publish --provider=\"Enflow\\Svg\\SvgServiceProvider\"\n```\n\n## Packs\nYou may specify multiple packs that are used in your application. By default, only the `resources/img/svgs` pack is included, but you may specify additional icon sets like Font Awesome in your config. When the pack isn't specified when including the SVG, the first one that can be found in the order defined in your config will be used. You may overrule this behavior by calling the `pack` method on the `Enflow\\Svg\\Svg` class that's returned by the SVG helper.\n\n```php\n\u003c?php\n\nreturn [\n    'packs' =\u003e [\n        'custom' =\u003e resource_path('img/svgs/'),\n        'fas' =\u003e [\n            'path' =\u003e base_path('vendor/fortawesome/font-awesome/svgs/solid/'),\n            'auto_size_on_viewbox' =\u003e true,\n        ],\n        'fal' =\u003e [\n            'path' =\u003e base_path('vendor/fortawesome/font-awesome/svgs/light/'),\n            'auto_size_on_viewbox' =\u003e true,\n        ],\n    ],\n];\n```\n\n### Examples\n#### Font Awesome 5 Free\n\n##### Installing\n`composer require fortawesome/font-awesome`\n\nReference: https://github.com/FortAwesome/Font-Awesome\n\n##### Config\n```php\n\u003c?php\n\nreturn [\n    'packs' =\u003e [\n        'custom' =\u003e resource_path('img/svgs/'),\n        'fas' =\u003e [\n            'path' =\u003e base_path('vendor/fortawesome/font-awesome/svgs/solid/'),\n            'auto_size_on_viewbox' =\u003e true,\n        ],\n    ],\n];\n```\n#### Font Awesome 5 Pro\n\n##### Installing\n\n`yarn add @fortawesome/fontawesome-pro`\n\n_Font Awesome 5 doesn't provide a composer package. We'll install it through our npm/yarn pipeline and use that path instead_\n\nReference: https://fontawesome.com/how-to-use/on-the-web/setup/using-package-managers\n\n##### Config\n```php\n\u003c?php\n\nreturn [\n    'packs' =\u003e [\n        'custom' =\u003e resource_path('img/svgs/'),\n        'fas' =\u003e [\n            'path' =\u003e base_path('node_modules/@fortawesome/fontawesome-pro/svgs/solid/'),\n            'auto_size_on_viewbox' =\u003e true,\n        ],\n    ],\n];\n```\n\n## Middleware\nThis package includes the `Enflow\\Svg\\Middleware\\InjectSvgSpritesheet` middleware which is automatically registered and added to your `web` group. \n\nThis will add the SVG spritesheet to the top of your templates, where all unique SVGs are added. The SVGs rendered in your templates will reference this spritesheet. The reason for this is that in a loop, the SVG only is once in the body, instead of repeating it per row.\n\nYou may disable the automatic injection by setting the `register_middleware_automatically` to `false`:\n\n##### config/svg.php\n```php\n\u003c?php\n\nreturn [\n    'register_middleware_automatically' =\u003e false\n];\n```\n\n### Using with other middleware\nWhen using `enflow/laravel-svg` in combination with another middleware that must always be executed after the SVGs are injected in the response, you may use the $middlewarePriority logic on the Laravel router to ensure it's always run after. \n\nThe order in this array is counterintuitive: at first must the `CacheResponse` middleware be specified, and then the SVG injection middleware. This is due to the way middleware responses are build. This ensures that first the SVGs are injected, and that complete response is cached.\n\nExample for usage with [spatie/laravel-responsecache](https://github.com/spatie/laravel-responsecache)\n\n##### app/Http/Kernel.php\n```\nprotected $middlewarePriority = [\n    ...\n    \\Spatie\\ResponseCache\\Middlewares\\CacheResponse::class,\n    \\Enflow\\Svg\\Middleware\\InjectSvgSpritesheet::class,\n];\n``` \n\n## Testing\n``` bash\n$ composer test\n```\n\n## Contributing\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security\nIf you discover any security related issues, please email michel@enflow.nl instead of using the issue tracker.\n\n## Credits\n- [Michel Bardelmeijer](https://github.com/mbardelmeijer)\n- [All Contributors](../../contributors)\n\n## Special thanks\n- github.com/jerodev/laravel-font-awesome for the idea\n- github.com/adamwathan/blade-svg for the research\n- github.com/spatie for the GitHub actions test workflow\n\n## About Enflow\nEnflow is a digital creative agency based in Alphen aan den Rijn, Netherlands. We specialize in developing web applications, mobile applications and websites. You can find more info [on our website](https://enflow.nl/en).\n\n## License\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%2Fenflow%2Flaravel-svg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenflow%2Flaravel-svg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenflow%2Flaravel-svg/lists"}