phattarachai/line-notify
Composer 安装命令:
composer require phattarachai/line-notify
包简介
PHP and Laravel API for Line application notification.
README 文档
README
The package for Laravel and PHP for Line application notification.
Line Notify is a package for Laravel and PHP application to easily send notification to Line messaging application users or groups. It builds on top of Line Notify API, that provides a fluent interface to send messages, images ,and stickers directly to Line service from Laravel and PHP.
Installing Line Notify
You need to use Composer to install Line-Notify into your project:
composer require phattarachai/line-notify
Laravel Usage
Add a LINE_ACCESS_TOKEN variable to your .env. You can get an access token for your application
from Line Notify API
// .env LINE_ACCESS_TOKEN=#Token Go here#
Send a message via Line Notify.
use Phattarachai\LineNotify\Facade\Line; Line::send('message');
You can use setToken() to specify other ACCESS_TOKEN you want to use beside from the .env.
use Phattarachai\LineNotify\Facade\Line; Line::setToken(/*...access token */) ->send('message');
Send a message with an image.
Line::imageUrl('https://lorempixel.com/1024/1024/') ->send('message');
You can also specify a thumbnail for your image
Line::thumbnailUrl('https://lorempixel.com/240/240/') ->imageUrl('https://lorempixel.com/1024/1024/') ->send('message');
You can upload an image from your local path
Line::imagePath('/path/to/your/image.png') ->send('message');
You can combine image uploading and image url together. The uploaded image will take precedence to image url.
Line::thumbnailUrl('https://lorempixel.com/240/240/') ->imageUrl('https://lorempixel.com/1024/1024/') ->imagePath('/path/to/your/image.png') ->send('message');
Send a message with sticker. You can find a list of Sticker Package ID and Sticker ID here https://devdocs.line.me/files/sticker_list.pdf
Line::sticker(1, 138) ->send('message');
Notice that Line require to have a message for each and every request whether you send an image or sticker you still required to provide a message for the API.
Publishing the configuration file
Alternatively to adding a variable into your .env, you can publish config/line-notify.php file and add your token
there.
Run the following Artisan command in your terminal:
php artisan vendor:publish --provider="Phattarachai\LineNotify\LineNotifyServiceProvider"
You can set the token in this file.
// File: /config/line-notify.php return [ 'access_token' => env('LINE_ACCESS_TOKEN'), ];
Configuring (Laravel)
Laravel 5.5 and newer
Line Notify wil register itself using Laravel's Auto Discovery.
Laravel 5.4 and older
You'll have to include LineNotifyServiceProvider in your config/app.php:
'providers' => [ /* * Package Service Providers... */ Phattarachai\LineNotify\LineNotifyServiceProvider::class, ]
PHP Usage (outside Laravel)
use Phattarachai\LineNotify\Line; $line = new Line('YOUR-API-TOKEN-HERE'); $line->send('message');
Screenshot
สนับสนุนผู้พัฒนา
🙋♂️ สวัสดีครับ ผมอ๊อฟนะครับ เป็น Full Stack Web Developer มีสร้าง package ขึ้นมาใช้งานในโปรเจคตัวเองที่ใช้งานบ่อย ๆ ถ้ามีข้อเสนอแนะอยากให้ทำ package อะไรบน PHP / Laravel / NodeJS / Python หรือภาษาอื่น ๆ ทักทายมาได้เลยครับ
line: phat-chai
💻 รับงาน Freelance หากมีโปรเจคที่น่าสนใจ หาทีมงานร่วมงาน หาโปรแกรมเมอร์ที่มีประสบการณ์ช่วยแก้โจทย์ที่ท้าทาย ติดต่อมาได้เลยครับ ยินดีให้ความช่วยเหลือและรอสร้างผลงานที่ดีร่วมกันครับ
📄 เข้ามาดูประวัติและผลงานได้ที่ https://phattarachai.dev
License
The MIT License (MIT)
phattarachai/line-notify 适用场景与选型建议
phattarachai/line-notify 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 31.94k 次下载、GitHub Stars 达 16, 最近一次更新时间为 2021 年 02 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「line」 「laravel」 「phattarachai」 「line-notify」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 phattarachai/line-notify 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 phattarachai/line-notify 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 phattarachai/line-notify 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PHP console tool to generate Markdown documentation from your docblocks and types hints using templates.
A minimal command-line framework built from Aura v2 packages
LINE Messaging API SDK for PHP Wrapper
Alfabank REST API integration
The PHP library for use with the Line Login OAuth REST API.
PHP5 library to create charts.
统计信息
- 总下载量: 31.94k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 16
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-02-13

