dario_swain / wall-poster-bundle
Wall posting for social groups
Installs: 1 310
Dependents: 0
Suggesters: 0
Security: 0
Stars: 15
Watchers: 7
Forks: 5
Type:symfony-bundle
Requires
- php: >=5.3.2
- ext-curl: *
- dg/twitter-php: 3.3
- facebook/php-sdk-v4: 4.0.*
- symfony/symfony: 2.*
This package is not auto-updated.
Last update: 2024-10-26 15:41:22 UTC
README
The WallPosterBundle bundle allows you to post your site news in your social groups, pages or timelines.
Installation
Add this bundle to your composer.json
file:
{
"require": {
"dario_swain/wall-poster-bundle": "dev-master"
}
}
You should browse
dario_swain/wall-poster-bundle
page to choose a stable version to use, avoid the @stable
meta constraint.
Register the bundle in app/AppKernel.php
:
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new new WallPosterBundle\WallPosterBundle(),
);
}
Import the routing definition in routing.yml
:
# app/config/routing.yml
WallPosterBundle:
resource: "@WallPosterBundle/Resources/routing/routing.yml"
This route (/wall-poster/captcha) used for enter captcha value if
vk.com
block your api requests
Enable the bundle's configuration in app/config/config.yml
:
# app/config/config.yml
wall_poster:
vk:
access_token: VK_STANDALONE_APPLICATION_ACCESS_TOKEN
group_id: VK_GROUP_ID
facebook:
access_token: FACEBOOK_ACCESS_TOKEN
app_id: FACEBOOK_APPLICATION_ID
app_secret: FACEBOOK_APPLICATION_SECRET
page: FACEBOOK_PAGE_ID
twitter:
api_key: TWITTER_APP_KEY
api_secret: TWITTER_APP_SECRET
access_token: TWITTER_ACCESS_TOKEN
access_secret: TWITTER_ACCESS_TOKEN_SECRET
Usage
You can publish your posts in social networks, for use this you can use special wall-poster services.
Post
Create WallPosterBundle\Post\Post
for publisher
<?php namespace Your\Namespace; use WallPosterBundle\Post\Post; class YourController extends Controller { public function updateAction() { /** Create you Post instance **/ $post = new Post(); /** Add image to post, you can provide absolute path for your local file and browser url to file **/ $post->createImage('/var/www/images/test.jpg','http://your_site.com/images/test.jpg') /** Add link to post **/ ->createLink('http://your_site.com/about') /** Add social tags **/ ->addTag('about') ->addTag('your_site') ->addTag('follow_me') /** Add message to your post **/ ->setMessage('Hello world!'); } }
After creation Post instance you can publish it with social network providers.
Social network providers
The bundle provide an wall_poster.vk
, wall_poster.facebook
and wall_poster.twitter
services, after Post creation:
<?php namespace Your\Namespace; use WallPosterBundle\Post\Post; class YourController extends Controller { public function updateAction() { /** Create you Post instance **/ $post = new Post(); /** ... **/ $provider = $this->get('wall_poster.vk'); try { $post = $provider->publish($post); } catch(Exception $ex) { //Handle errors } } }