{"id":15637173,"url":"https://github.com/log1x/sage-svg","last_synced_at":"2025-04-08T06:35:28.486Z","repository":{"id":35008533,"uuid":"196082117","full_name":"Log1x/sage-svg","owner":"Log1x","description":"A simple package for using inline SVGs with Sage 10.","archived":false,"fork":false,"pushed_at":"2024-10-05T23:43:17.000Z","size":76,"stargazers_count":117,"open_issues_count":3,"forks_count":13,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-01T04:53:26.907Z","etag":null,"topics":["blade-directives","sage","svg","wordpress"],"latest_commit_sha":null,"homepage":"https://github.com/log1x/sage-svg","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/Log1x.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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},"funding":{"github":"Log1x"}},"created_at":"2019-07-09T20:51:58.000Z","updated_at":"2025-03-24T06:01:45.000Z","dependencies_parsed_at":"2023-11-17T00:49:50.634Z","dependency_job_id":"a6a3ac20-8fda-4c7c-9f3f-da34136f3213","html_url":"https://github.com/Log1x/sage-svg","commit_stats":{"total_commits":56,"total_committers":12,"mean_commits":4.666666666666667,"dds":0.3214285714285714,"last_synced_commit":"c871fa875830b69ee751e97d1914a5c5458376d2"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Log1x%2Fsage-svg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Log1x%2Fsage-svg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Log1x%2Fsage-svg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Log1x%2Fsage-svg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Log1x","download_url":"https://codeload.github.com/Log1x/sage-svg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247792856,"owners_count":20996890,"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":["blade-directives","sage","svg","wordpress"],"created_at":"2024-10-03T11:10:35.469Z","updated_at":"2025-04-08T06:35:28.468Z","avatar_url":"https://github.com/Log1x.png","language":"PHP","funding_links":["https://github.com/sponsors/Log1x"],"categories":[],"sub_categories":[],"readme":"# Sage SVG\n\n![Latest Stable Version](https://img.shields.io/packagist/v/log1x/sage-svg.svg?style=flat-square)\n![Total Downloads](https://img.shields.io/packagist/dt/log1x/sage-svg.svg?style=flat-square)\n![Build Status](https://img.shields.io/github/actions/workflow/status/log1x/sage-svg/main.yml?branch=master\u0026style=flat-square)\n\nSage SVG is a simple package for using inline SVGs in your Sage 10 projects.\n\n## Requirements\n\n- [Sage](https://github.com/roots/sage) \u003e= 10.x\n- [Acorn](https://github.com/roots/acorn) \u003e= 4.x\n- [PHP](https://secure.php.net/manual/en/install.php) \u003e= 8.1\n- [Composer](https://getcomposer.org/download/)\n\n## Installation\n\nInstall via Composer:\n\n```bash\n$ composer require log1x/sage-svg\n```\n\n## Usage\n\nBy default, the following paths are checked for your SVG (in order):\n\n- If passed an array containing `id`, it is assumed to be a WordPress attachment and is ran through [`get_attached_file()`](https://developer.wordpress.org/reference/functions/get_attached_file).\n- Your default asset manifest (usually `mix-manifest.json`).\n- Path relative to `config('svg.path')` which is `public_path()` by default.\n- Absolute web root path.\n\n### Blade Directive\n\nUnless you require advance functionality from somewhere such as a Controller, the best way to use Sage SVG is with the Blade directive straight in your templates.\n\n```php\n# Relative path (with dot notation) – resolves to `app/themes/\u003cyour theme\u003e/dist/images/logo.svg` by default\n@svg('images.logo')\n\n# Absolute path from webroot with `w-32 h-auto` CSS classes and an aria-label\n@svg('app/uploads/2019/07/logo.svg', 'w-32 h-auto', ['aria-label' =\u003e 'Logo'])\n```\n\n### Helper\n\nThe easiest way to use SVG outside of a Blade template is the global `get_svg()` helper function. `get_svg()` will return `false` if no image is found.\n\n```php\n# Relative path\n$image = get_svg('images.logo');\n\n# Absolute path from webroot with `w-32 h-auto` CSS classes\n$image = get_svg('app/uploads/2019/07/logo.svg', 'w-32 h-auto');\n\n# WordPress attachment (e.g. ACF field) with `my-logo` CSS class\n$image = get_svg(\n    get_field('logo_svg'),\n    'my-logo'\n);\n```\n\n### Facade\n\nAnother option for rendering an SVG is using the `SageSvg` Facade:\n\n```php\nuse Log1x\\SageSvg\\Facades\\SageSvg;\n\n$image = SageSvg::render('images.logo');\n```\n\n## Configuration\n\nThe configuration file, `svg.php`, can be published using Acorn:\n\n```bash\n$ wp acorn vendor:publish --provider='Log1x\\SageSvg\\SageSvgServiceProvider'\n```\n\nYou can read the DocBlocks in `config/svg.php` for more details.\n\n## Why another SVG Package?\n\n\u003e Didn't you author Blade SVG Sage? Why another SVG package?\n\nWhile I do have my fork of [Blade SVG](https://github.com/adamwathan/blade-svg) called [Blade SVG Sage](https://github.com/log1x/blade-svg-sage), I find it rather underwhelming due to the following reasons:\n\n- Unable to handle WordPress attachments\n- Unable to inline SVGs that aren't set in a specific path\n- Unable to properly use the asset manifest.\n- I know QWp6t\n\n## Bug Reports\n\nIf you discover a bug in Sage SVG, please [open an issue](https://github.com/log1x/sage-svg/issues).\n\n## Contributing\n\nContributing whether it be through PRs, reporting an issue, or suggesting an idea is encouraged and appreciated.\n\n## License\n\nSage SVG is provided under the [MIT License](https://github.com/log1x/sage-svg/blob/master/LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flog1x%2Fsage-svg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flog1x%2Fsage-svg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flog1x%2Fsage-svg/lists"}