From bc15f3a1df57de29f039f33da457dbf7252b062b Mon Sep 17 00:00:00 2001 From: Sven Luijten Date: Sat, 6 Jan 2024 15:34:01 +0100 Subject: [PATCH] Update README to use interfaces instead of enums --- README.md | 13 ++++++++----- tests/Integration/ImageTest.php | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ca3b83a..574bcb3 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,8 @@ composer require simonhamp/the-og --with-all-dependencies Using The OG is really simple. Here's a basic example: ```php +use SimonHamp\TheOg\Backgrounds\JustWaves; use SimonHamp\TheOg\Image; -use SimonHamp\TheOg\Background; (new Image()) ->accentColor('#cc0000') @@ -39,7 +39,7 @@ use SimonHamp\TheOg\Background; ->url('https://example.com/blog/some-blog-post-url') ->title('Some blog post title that is quite big and quite long') ->description('Some slightly smaller but potentially much longer subtext. It could be really long so we might need to trim it completely after many words') - ->background(Background::JustWaves, 0.2) + ->background(new JustWaves(), 0.2) ->save(__DIR__.'/test.png'); ``` @@ -65,17 +65,20 @@ Themes are simple classes. You can create your own theme simply by extending the ```php use SimonHamp\TheOg\Themes\AbstractTheme; +use SimonHamp\TheOg\Fonts\InterBlack; +use SimonHamp\TheOg\Fonts\InterBold; +use SimonHamp\TheOg\Fonts\InterLight; $theme = new class( accentColor: '#247BA0', backgroundColor: '#ECEBE4', baseColor: '#153B50', - baseFont: Font::InterBold, + baseFont: new InterBold(), callToActionBackgroundColor: '#153B50', callToActionColor: '#ECEBE4', descriptionColor: '#429EA6', - descriptionFont: Font::InterLight, - titleFont: Font::InterBlack, + descriptionFont: new InterLight(), + titleFont: new InterBlack(), ) extends AbstractTheme {}; $image = new Image; diff --git a/tests/Integration/ImageTest.php b/tests/Integration/ImageTest.php index fd6eac1..50b4c90 100644 --- a/tests/Integration/ImageTest.php +++ b/tests/Integration/ImageTest.php @@ -3,7 +3,7 @@ namespace Tests\Integration; use PHPUnit\Framework\Attributes\DataProvider; -use SimonHamp\TheOg\Background; +use SimonHamp\TheOg\Backgrounds\JustWaves; use SimonHamp\TheOg\Image; use SimonHamp\TheOg\Themes\Themes; use Spatie\Snapshots\MatchesSnapshots; @@ -52,7 +52,7 @@ public static function snapshotImages(): iterable Some slightly smaller but potentially much longer subtext. It could be really long so we might need to trim it completely after many words. TEXT ) - ->background(Background::JustWaves, 0.2), + ->background(new JustWaves(), 0.2), 'override-some-elements', ];