承接 aniftyco/laravel-og-image 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aniftyco/laravel-og-image

Composer 安装命令:

composer require aniftyco/laravel-og-image

包简介

Open Graph Image Generator for Laravel

README 文档

README

Warning

This package is not ready for general consumption

Requirements

Requires PHP 8.1+ and a Chrome/Chromium 65+ executable.

Installation

You can install the package via Composer:

composer require aniftyco/laravel-og-image:dev-master

Usage

There are multiple ways you can utilize this.

GET /og-image Route

This 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/.

Take this example:

https://example.com/og-image?template=post&title=You%20Can%20Just%20Do%20Things

It is telling the generator to use the post template and pass the $title property set to You Can Just Do Things.

og_image() Helper

Using 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.

Returning the OG image as a response:

Route::get('/{user}.png', function(User $user) {
    return og_image('user', compact('user'));
});

Saving the OG image to a disk:

$image = og_image('user', compact('user'));

$image->storeAs('og-images', ['disk' => 's3']);

Writing templates with Blade

Your images are generated using Blade templates, using the following example template in resources/views/og-image/example.blade.php:

<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    @vite(['resources/css/app.css'])
  </head>

  <body class="flex h-screen flex-col bg-[#F8F2E6]">
    <div class="shrink-0 px-20 pt-24 text-gray-900">
      <h1 class="text-[2.5rem] font-extrabold leading-[1.2]">
        {{ $name }}
      </h1>
    </div>
    <div class="flex grow items-center px-20">
      <h1 class="text-[5rem] font-extrabold leading-[1.2] text-gray-900">
        {{ $text }}
      </h1>
    </div>
  </body>

</html>

Then if you make a request to /og-image?template=example&name=OG%20Image%20Generator&text=The%20fastest%20way%20to%20create%20open%20graph%20images%20for%20Laravel! you will get the following image:

Contributing

Thank you for considering contributing to the Attachments for Laravel package! You can read the contribution guide here.

License

The MIT License (MIT). Please see License File for more information.

aniftyco/laravel-og-image 适用场景与选型建议

aniftyco/laravel-og-image 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 72 次下载、GitHub Stars 达 15, 最近一次更新时间为 2024 年 10 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「Open Graph Protocol」 「Open Graph Images」 「OG Image」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 aniftyco/laravel-og-image 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 aniftyco/laravel-og-image 我们能提供哪些服务?
定制开发 / 二次开发

基于 aniftyco/laravel-og-image 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 72
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 15
  • 点击次数: 10
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 15
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-24