2017 © Pedro Peláez
 

cakephp-plugin cakephp-social

CakePHP social parser

image

3xw/cakephp-social

CakePHP social parser

  • Monday, February 12, 2018
  • by awallef
  • Repository
  • 3 Watchers
  • 1 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

cakephp-social plugin for CakePHP.

Bring social networks to your website, (*1)

Installation

You can install this plugin into your CakePHP application using composer., (*2)

The recommended way to install composer packages is:, (*3)

composer require 3xw/cakephp-social

Load it in your config/boostrap.php, (*4)

Plugin::load('Trois/Social', ['routes' => true]);

In your database settings allow correct utf8 in app.php:, (*5)

...
Datasources => [
    'default' => [
        ...
        'encoding' => 'utf8mb4',
        ...
    ]
],
...

'Social' => [
  'facebook' => [
      'app_id' => 'XXX',
      'app_secret' => 'XXX',
      'default_graph_version' => 'v2.11',
  ],
  'twitter' => [
      'oauth_access_token' => 'XXX',
      'oauth_access_token_secret' => 'XXX',
      'consumer_key' => 'XXX',
      'consumer_secret' => 'XXX'
  ],
],
...

dB

Create a table db to store the posts, we suggest following if you use the plugin table class:, (*6)

CREATE TABLE `social_posts` (
  `id` varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `provider` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'facebook',
  `date` datetime NOT NULL,
  `created` datetime NOT NULL,
  `modified` datetime NOT NULL,
  `display` tinyint(1) NOT NULL DEFAULT '1',
  `link` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `message` text COLLATE utf8mb4_unicode_ci,
  `author` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `image` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`,`provider`),
  KEY `provider` (`provider`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; 

Usage

Shell

bin/cake social [facebook | instagram | twitter] [account | search] [needle] [limit] [-s] [-m table class]

code

You have three classes (Facebook, Instagram, Twitter) that implements:, (*7)

public $posts = [];

public function query($type, $key, $limit = 10);

public function toArray();

You can use it like so:, (*8)

use Trois\Social\Network\Http\Facebook;

$this->Facebook = new Facebook();
$this->Facebook->query('account, 'xxxxyyyy', 10); // searchType, needle, limit
debug($Facebook->toArray());

You have a model too:, (*9)

use Cake\ORM\TableRegistry;

$this->SocialPosts = TableRegistry::get('Trois/Social.SocialPosts');
$entities = $this->SocialPosts->newEntities($this->Facebook->toArray());
$results = $this->SocialPosts->saveMany($entities);

Admin

if you have an admin, you can visit:, (*10)

/admin/social

and modarate the content of the table 'Trois/Social.SocialPosts', (*11)

The Versions

12/02 2018

dev-master

9999999-dev

CakePHP social parser

  Sources   Download

The Requires

 

The Development Requires

12/02 2018

3.4.1.2

3.4.1.2

CakePHP social parser

  Sources   Download

The Requires

 

The Development Requires

05/02 2018

3.4.1.1

3.4.1.1

CakePHP social parser

  Sources   Download

The Requires

 

The Development Requires

01/02 2018

3.4.1.0

3.4.1.0

CakePHP social parser

  Sources   Download

The Requires

 

The Development Requires