Skip to content

Commit 510f911

Browse files
authored
✨ v2.0.0
2 parents 98ca9fb + 23874aa commit 510f911

File tree

10 files changed

+152
-241
lines changed

10 files changed

+152
-241
lines changed

.github/workflows/Main.yml renamed to .github/workflows/main.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
if: "!contains(github.event.head_commit.message, '[ci skip]')"
1616
strategy:
1717
matrix:
18-
php: ['7.4', '8.0', '8.1', '8.2']
18+
php: [8.1, 8.2]
1919

2020
steps:
2121
- name: Checkout the project
@@ -42,5 +42,5 @@ jobs:
4242
- name: Install Composer dependencies
4343
run: composer install --no-progress --prefer-dist --optimize-autoloader --no-suggest
4444

45-
- name: Execute the PHP lint script
46-
run: composer run-script lint
45+
- name: Run Pint
46+
run: vendor/bin/pint --test

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/vendor
2+
composer.lock

README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# Sage SVG
22

3-
[![Latest Stable Version](https://poser.pugx.org/log1x/sage-svg/v/stable)](https://packagist.org/packages/log1x/sage-svg)
4-
[![Total Downloads](https://poser.pugx.org/log1x/sage-svg/downloads)](https://packagist.org/packages/log1x/sage-svg)
5-
![Build Status](https://img.shields.io/github/actions/workflow/status/log1x/sage-svg/Main.yml?branch=master&style=flat-square)
3+
![Latest Stable Version](https://img.shields.io/packagist/v/log1x/sage-svg.svg?style=flat-square)
4+
![Total Downloads](https://img.shields.io/packagist/dt/log1x/sage-svg.svg?style=flat-square)
5+
![Build Status](https://img.shields.io/github/actions/workflow/status/log1x/sage-svg/main.yml?branch=master&style=flat-square)
66

77
Sage SVG is a simple package for using inline SVGs in your Sage 10 projects.
88

99
## Requirements
1010

11-
- [Sage](https://github.com/roots/sage) >= 10.0
12-
- [PHP](https://secure.php.net/manual/en/install.php) >= 7.4
11+
- [Sage](https://github.com/roots/sage) >= 10.x
12+
- [Acorn](https://github.com/roots/acorn) >= 4.x
13+
- [PHP](https://secure.php.net/manual/en/install.php) >= 8.1
1314
- [Composer](https://getcomposer.org/download/)
1415

1516
## Installation
@@ -59,15 +60,14 @@ $image = get_svg(
5960
);
6061
```
6162

62-
### App Container
63+
### Facade
6364

64-
While it's easier to use the Helper function, if it not available or sane for your scenario, you can render your SVG using the initialized `SageSvg` instance from the app container.
65+
Another option for rendering an SVG is using the `SageSvg` Facade:
6566

6667
```php
67-
use Log1x\SageSvg\SageSvg;
68-
use function Roots\app;
68+
use Log1x\SageSvg\Facades\SageSvg;
6969

70-
$image = app(SageSvg::class)->render('images.logo');
70+
$image = SageSvg::render('images.logo');
7171
```
7272

7373
## Configuration

composer.json

+7-8
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,20 @@
2626
]
2727
},
2828
"require": {
29-
"php": "^7.4|^8.0"
29+
"php": "^8.1"
3030
},
3131
"require-dev": {
32-
"squizlabs/php_codesniffer": "^3.5"
33-
},
34-
"scripts": {
35-
"lint": [
36-
"phpcs --ignore=vendor --extensions=php --standard=PSR12 ."
37-
]
32+
"roots/acorn": "^4.3",
33+
"laravel/pint": "^1.16"
3834
},
3935
"extra": {
4036
"acorn": {
4137
"providers": [
4238
"Log1x\\SageSvg\\SageSvgServiceProvider"
43-
]
39+
],
40+
"aliases": {
41+
"SageSvg": "Log1x\\SageSvg\\Facades\\SageSvg"
42+
}
4443
}
4544
}
4645
}

composer.lock

-78
This file was deleted.

config/svg.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
| Path
88
|--------------------------------------------------------------------------
99
|
10-
| This value is the default path used by SageSVG for finding SVG files.
11-
| This path is then resolved internally if an absolute path is not being
12-
| used.
10+
| This value is the default path used by Sage SVG for finding SVG files
11+
| when an absolute path is not specified. You may modify the path as
12+
| needed but the default value should work for most applications.
1313
|
1414
*/
1515

@@ -66,4 +66,5 @@
6666
// 'fa' => 'fa.solid',
6767
// 'brands' => 'fa.brands',
6868
],
69+
6970
];

src/Facades/SageSvg.php

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Log1x\SageSvg\Facades;
4+
5+
use Illuminate\Support\Facades\Facade;
6+
7+
/**
8+
* @method static string render(string $image, string|array $class = '', array $attrs = [], array $options = []) Render the SVG as HTML.
9+
*
10+
* @see \Log1x\SageSvg\SageSvg
11+
*/
12+
class SageSvg extends Facade
13+
{
14+
/**
15+
* Get the registered name of the component.
16+
*
17+
* @return string
18+
*/
19+
protected static function getFacadeAccessor()
20+
{
21+
return 'sage-svg';
22+
}
23+
}

0 commit comments

Comments
 (0)