{"id":17965972,"url":"https://github.com/aniftyco/laravel-og-image","last_synced_at":"2025-03-25T07:31:13.568Z","repository":{"id":259341207,"uuid":"877124148","full_name":"aniftyco/laravel-og-image","owner":"aniftyco","description":"Open Graph Image Generator for Laravel","archived":false,"fork":false,"pushed_at":"2024-10-27T01:11:29.000Z","size":113,"stargazers_count":16,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T06:08:40.048Z","etag":null,"topics":["laravel","laravel-package","og-image","opengraph-images","opengraphprotocol"],"latest_commit_sha":null,"homepage":"","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/aniftyco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2024-10-23T06:07:55.000Z","updated_at":"2025-01-19T04:54:59.000Z","dependencies_parsed_at":"2024-10-24T16:06:50.125Z","dependency_job_id":"c1ca6dcd-5291-41b8-8e3e-faa0cc8ec8e0","html_url":"https://github.com/aniftyco/laravel-og-image","commit_stats":null,"previous_names":["aniftyco/laravel-og-image"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aniftyco%2Flaravel-og-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aniftyco%2Flaravel-og-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aniftyco%2Flaravel-og-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aniftyco%2Flaravel-og-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aniftyco","download_url":"https://codeload.github.com/aniftyco/laravel-og-image/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245418287,"owners_count":20612105,"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":["laravel","laravel-package","og-image","opengraph-images","opengraphprotocol"],"created_at":"2024-10-29T13:06:21.483Z","updated_at":"2025-03-25T07:31:13.264Z","avatar_url":"https://github.com/aniftyco.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Open Graph Image Generator for Laravel\n\n\u003e [!WARNING]\n\u003e This package is not ready for general consumption\n\n## Requirements\n\nRequires PHP 8.1+ and a Chrome/Chromium 65+ executable.\n\n## Installation\n\nYou can install the package via Composer:\n\n```sh\ncomposer require aniftyco/laravel-og-image:dev-master\n```\n\n## Usage\n\nThere are multiple ways you can utilize this.\n\n### `GET /og-image` Route\n\nThis package registers a `GET` route to `/og-image` which accepts a varadic amount of parameters where only `template` is required and special. This tells the image generator what template to use relavent to `resources/views/og-image/`.\n\nTake this example:\n\n```\nhttps://example.com/og-image?template=post\u0026title=You%20Can%20Just%20Do%20Things\n```\n\nIt is telling the generator to use the `post` template and pass the `$title` property set to `You Can Just Do Things`.\n\n### `og_image()` Helper\n\nUsing the `og_image()` helper you have more control over what happens with the OG Images generated. This helper accepts a `template` and an array of data to pass to the view.\n\n#### Returning the OG image as a response:\n\n```php\nRoute::get('/{user}.png', function(User $user) {\n    return og_image('user', compact('user'));\n});\n```\n\n#### Saving the OG image to a disk:\n\n```php\n$image = og_image('user', compact('user'));\n\n$image-\u003estoreAs('og-images', ['disk' =\u003e 's3']);\n```\n\n### Writing templates with Blade\n\nYour images are generated using Blade templates, using the following example template in `resources/views/og-image/example.blade.php`:\n\n```blade\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\n  \u003chead\u003e\n    \u003cmeta charset=\"utf-8\" /\u003e\n    \u003cmeta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" /\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /\u003e\n    @vite(['resources/css/app.css'])\n  \u003c/head\u003e\n\n  \u003cbody class=\"flex h-screen flex-col bg-[#F8F2E6]\"\u003e\n    \u003cdiv class=\"shrink-0 px-20 pt-24 text-gray-900\"\u003e\n      \u003ch1 class=\"text-[2.5rem] font-extrabold leading-[1.2]\"\u003e\n        {{ $name }}\n      \u003c/h1\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"flex grow items-center px-20\"\u003e\n      \u003ch1 class=\"text-[5rem] font-extrabold leading-[1.2] text-gray-900\"\u003e\n        {{ $text }}\n      \u003c/h1\u003e\n    \u003c/div\u003e\n  \u003c/body\u003e\n\n\u003c/html\u003e\n\n```\n\nThen if you make a request to `/og-image?template=example\u0026name=OG%20Image%20Generator\u0026text=The%20fastest%20way%20to%20create%20open%20graph%20images%20for%20Laravel!` you will get the following image:\n\n![](.github/assets/example.png)\n\n## Contributing\n\nThank you for considering contributing to the Attachments for Laravel package! You can read the contribution guide [here](CONTRIBUTING.md).\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faniftyco%2Flaravel-og-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faniftyco%2Flaravel-og-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faniftyco%2Flaravel-og-image/lists"}