Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
simonhamp committed Dec 22, 2023
0 parents commit 2032d09
Show file tree
Hide file tree
Showing 10 changed files with 252 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
/vendor
20 changes: 20 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "simonhamp/the-og",
"description": "OpenGraph Image Generator for PHP",
"type": "library",
"require": {
"intervention/image": "^3.1"
},
"license": "MIT",
"autoload": {
"psr-4": {
"SimonHamp\\TheOg\\": "src/"
}
},
"authors": [
{
"name": "Simon Hamp",
"email": "[email protected]"
}
]
}
138 changes: 138 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added resources/images/bananas.webp
Binary file not shown.
Binary file added resources/images/cloudy-day.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/just-waves.webp
Binary file not shown.
10 changes: 10 additions & 0 deletions src/Background.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace SimonHamp\TheOg;

enum Background: string
{
case Bananas = 'bananas.webp';
case CloudyDay = 'cloud-day.png';
case JustWaves = 'just-waves.webp';
}
9 changes: 9 additions & 0 deletions src/ColorScheme.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace SimonHamp\TheOg;

enum ColorScheme: string
{
case Light = 'light';
case Dark = 'dark';
}
63 changes: 63 additions & 0 deletions src/Image.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

namespace SimonHamp\TheOg;

class Image
{
protected string $url;
protected string $title;
protected string $description;
protected Theme $theme;
protected ColorScheme $colorScheme;
protected string $accentColor;
protected Background $background;
protected string $callToAction;

public function url(string $url): self
{
$this->url = $url;
return $this;
}

public function title(string $title): self
{
$this->title = $title;
return $this;
}

public function description(string $description): self
{
$this->description = $description;
return $this;
}

public function theme(Theme $theme): self
{
$this->theme = $theme;
return $this;
}

public function colorScheme(ColorScheme $colorScheme): self
{
$this->colorScheme = $colorScheme;
return $this;
}

public function accentColor(string $hexCode): self
{
$this->accentColor = $hexCode;
return $this;
}

public function background(Background $background): self
{
$this->background = $background;
return $this;
}

public function callToAction(string $content): self
{
$this->callToAction = $content;
return $this;
}
}
10 changes: 10 additions & 0 deletions src/Theme.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace SimonHamp\TheOg;

enum Theme: string
{
case Standard = 'standard';
case Bold = 'bold';
case Split = 'split';
}

0 comments on commit 2032d09

Please sign in to comment.