Skip to content

Commit

Permalink
✨ v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Log1x authored Jul 16, 2024
2 parents 98ca9fb + 23874aa commit 510f911
Show file tree
Hide file tree
Showing 10 changed files with 152 additions and 241 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/Main.yml → .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
matrix:
php: ['7.4', '8.0', '8.1', '8.2']
php: [8.1, 8.2]

steps:
- name: Checkout the project
Expand All @@ -42,5 +42,5 @@ jobs:
- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader --no-suggest

- name: Execute the PHP lint script
run: composer run-script lint
- name: Run Pint
run: vendor/bin/pint --test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/vendor
composer.lock
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Sage SVG

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

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

## Requirements

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

## Installation
Expand Down Expand Up @@ -59,15 +60,14 @@ $image = get_svg(
);
```

### App Container
### Facade

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.
Another option for rendering an SVG is using the `SageSvg` Facade:

```php
use Log1x\SageSvg\SageSvg;
use function Roots\app;
use Log1x\SageSvg\Facades\SageSvg;

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

## Configuration
Expand Down
15 changes: 7 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,20 @@
]
},
"require": {
"php": "^7.4|^8.0"
"php": "^8.1"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.5"
},
"scripts": {
"lint": [
"phpcs --ignore=vendor --extensions=php --standard=PSR12 ."
]
"roots/acorn": "^4.3",
"laravel/pint": "^1.16"
},
"extra": {
"acorn": {
"providers": [
"Log1x\\SageSvg\\SageSvgServiceProvider"
]
],
"aliases": {
"SageSvg": "Log1x\\SageSvg\\Facades\\SageSvg"
}
}
}
}
78 changes: 0 additions & 78 deletions composer.lock

This file was deleted.

7 changes: 4 additions & 3 deletions config/svg.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
| Path
|--------------------------------------------------------------------------
|
| This value is the default path used by SageSVG for finding SVG files.
| This path is then resolved internally if an absolute path is not being
| used.
| This value is the default path used by Sage SVG for finding SVG files
| when an absolute path is not specified. You may modify the path as
| needed but the default value should work for most applications.
|
*/

Expand Down Expand Up @@ -66,4 +66,5 @@
// 'fa' => 'fa.solid',
// 'brands' => 'fa.brands',
],

];
23 changes: 23 additions & 0 deletions src/Facades/SageSvg.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Log1x\SageSvg\Facades;

use Illuminate\Support\Facades\Facade;

/**
* @method static string render(string $image, string|array $class = '', array $attrs = [], array $options = []) Render the SVG as HTML.
*
* @see \Log1x\SageSvg\SageSvg
*/
class SageSvg extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'sage-svg';
}
}
Loading

0 comments on commit 510f911

Please sign in to comment.