ahmedash95/laravel-facebook-poster-notification 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

ahmedash95/laravel-facebook-poster-notification

Composer 安装命令:

composer require ahmedash95/laravel-facebook-poster-notification

包简介

Laravel Notification for posting on Facebook

README 文档

README

Latest Version on Packagist Software License Build Status StyleCI SensioLabsInsight Quality Score Code Coverage Total Downloads

This package makes it easly to post on facebook using FacebookPoster Notification with Laravel 5.3

Contents

Installation

You can install this package via composer:

composer require laravel-notification-channels/facebook-poster

Next add the service provider to your config/app.php:

...
'providers' => [
	...
	 NotificationChannels\FacebookPoster\FacebookPosterServiceProvider::class,
],
...

Setting up the Facebook Poster service

You will need to create a Facebook app in order to use this channel. Within in this app you will find the APP Id and APP Secret Key. Place them inside your .env file. In order to load them, add this to your config/services.php file:

...
'facebook_poster' => [
	'app_id'    => getenv('FACEBOOK_APP_ID'),
	'app_secret' => getenv('FACEBOOK_APP_SECRET'),
	'access_token'    => getenv('FACEBOOK_ACCESS_TOKEN'),
]
...

This will load the Facebook app data from the .env file. Make sure to use the same keys you have used there like FACEBOOK_APP_ID.

To create a life time access token for your fan page, open the Graph Api Explorer on the right body heading, select your app then click on the get token button and select Get Page Access Token then select your page, after this add access_token parameter into the query string me?fields=id,name,access_token then submit and copy the access token value to your env FACEBOOK_ACCESS_TOKEN.

Usage

Follow Laravel's documentation to add the channel to your Notification class.

Publish Facebook post

use NotificationChannels\FacebookPoster\FacebookPosterChannel;
use NotificationChannels\FacebookPoster\FacebookPosterPost;

class NewsWasPublished extends Notification
{

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return [FacebookPosterChannel::class];
    }

    public function toFacebookPoster($notifiable) {
        return new FacebookPosterPost('Laravel notifications are awesome!');
    }
}

Available methods

Take a closer look at the FacebookPosterPost object. This is where the magic happens.

public function toFacebookPoster($notifiable) {
    return new FacebookPosterPost('Laravel notifications are awesome!');
}

Publish Facebook post with link

It is possible to publish link with your post too. You just have to pass the url to the withLink method.

public function toFacebookPoster($notifiable) {
    return (new FacebookPosterPost('Laravel notifications are awesom!'))->withLink('https://laravel.com');
}

Publish Facebook post with image

It is possible to publish image with your post too. You just have to pass the image path to the withImage method.

public function toFacebookPoster($notifiable) {
    return (new FacebookPosterPost('Laravel notifications are awesom!'))->withImage('tayee.png');
}

Notice : withImage accepts absolute url not system paths like /home/user/downloads/image.png

Publish Facebook post with video

It is also possible to publish video with your post too. You just have to pass the video path to the withVideo method.

public function toFacebookPoster($notifiable) {
    return (new FacebookPosterPost('Laravel notifications are awesom!'))
    	->withVideo('bedaer.mp4',[ 'title' => 'My First Video' , 'Description' => 'published by FacebookPoster.' ]);
}

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please email ahmed29329@gmail.com instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

License

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

ahmedash95/laravel-facebook-poster-notification 适用场景与选型建议

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

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

围绕 ahmedash95/laravel-facebook-poster-notification 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-11-10