Giter Club home page Giter Club logo

social-post-bundle's Introduction

Scrutinizer Code Quality Build Status Coverage Status Latest Stable Version Total Downloads

Upgrading?

Check the upgrade guide.


What's this?

This is a Symfony bundle written in PHP 7.1 that wraps martin-georgiev/social-post - an easy way for simultaneous publishing to multiple social networks. Currently, it integrates with Facebook, LinkedIn and Twitter.


How to install it?

Recommended way is through Composer

composer require martin-georgiev/social-post-bundle

Integration with Symfony

Add social networks configuration

# Usually part of config.yml
social_post:
    publish_on: [facebook, linkedin, twitter]         # List which Social networks you will be publishing to and configure your access to them as shown below
    providers:
        facebook:
            app_id: "YOUR-FACEBOOK-APP-ID"
            app_secret: "YOUR-FACEBOOK-APP-SECRET"
            default_access_token: "YOUR-FACEBOOK-NON-EXPIRING-PAGE-ACCESS-TOKEN"
            page_id: "YOUR-FACEBOOK-PAGE-ID"
            enable_beta_mode: true
            default_graph_version: "v2.8"             # Optional, also supports "mcrypt" and "urandom". Default uses the latest graph version.
            persistent_data_handler: "memory"         # Optional, also supports "session". Default is "memory".
            pseudo_random_string_generator: "openssl" # Optional, also supports "mcrypt" and "urandom". Default is "openssl".
            http_client_handler: "curl"               # Optional, also supports "stream" and "guzzle". Default is "curl".
        linkedin:
            client_id: "YOUR-LINKEDIN-APP-CLIENT-ID"
            client_secret: "YOUR-LINKEDIN-APP-CLIENT-SECRET"
            access_token: "YOUR-LINKEDIN-60-DAYS-LONG-USER-ACCESS-TOKEN"
            company_page_id: "YOUR-LINKEDIN-COMPANY-PAGE-ID"
        twitter:
            consumer_key: "YOUR-TWITTER-APP-CONSUMER-KEY"
            consumer_secret: "YOUR-TWITTER-APP-CONSUMER-SECRET"
            access_token: "YOUR-TWITTER-ACCESS-TOKEN"
            access_token_secret: "YOUR-TWITTER-ACCESS-TOKEN-SECRET"

Register the bundle

# Usually your app/AppKernel.php
<?php
// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...
            new \MartinGeorgiev\SocialPostBundle\SocialPostBundle(),
        ];
        return $bundles;
    }
    // ...
}

Post a test message

# Some Symfony container aware class
<?php
//...
$message = new \MartinGeorgiev\SocialPost\Message('your test message');
$container->get('social_post')->publish($message);

Additional help

Twitter has limited features for tweet customisation. This means that for tweets only message and link values (MartinGeorgiev\SocialPost\Message instance) will be used.

Facebook doesn't support non-expiring user access tokens. Instead, you can obtain a permanent page access token. When using such tokens you can act and post as the page itself. More information about the page access tokens from the official Facebook documentation. Some Stackoverflow answers (here and here) also can of help.


License

This package is licensed under the MIT License.

social-post-bundle's People

Contributors

martin-georgiev avatar dependabot-preview[bot] avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.