PHPackages                             jedelhu/socialpack - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. jedelhu/socialpack

ActiveProject[Authentication &amp; Authorization](/categories/authentication)

jedelhu/socialpack
==================

This will allow to login and upload data on facebook and twitter

15PHP

Since Sep 28Pushed 9y ago2 watchersCompare

[ Source](https://github.com/jedelhu/Socialpack)[ Packagist](https://packagist.org/packages/jedelhu/socialpack)[ RSS](/packages/jedelhu-socialpack/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Socialpack
==========

[](#socialpack)

Facebook and Twitter Libraries

Installation
------------

[](#installation)

Begin by installing this package through Composer.

Add this line in composer.json file under "require":

```
"jedelhu/Socialpack": "dev-master",

```

Add this line in app.php under 'providers':

```
Jedelhu\Socialpack\SocialpackServiceProvider::class

```

Run this command in command line:

```
php artisan vendor:publish --provider="Jedelhu\Socialpack\SocialpackServiceProvider"

```

Configuration
-------------

[](#configuration)

Give valid app\_id and app\_secret keys for both api in config\\socialpack.php

Callback function for twitter

```
http://yourdomain.com/callbackTwitter

```

Callback function for facebook

```
http://yourdomain.com/loginFacebook

```

Change following code in facebook sdk v4 package(to convert in laravel):
------------------------------------------------------------------------

[](#change-following-code-in-facebook-sdk-v4-packageto-convert-in-laravel)

Go to vendor\\facebook\\php-sdk-v4\\src\\Facebook\\Helpers\\FacebookRedirectLoginHelper.php on line 123,

I change this script:

```
private function makeUrl($redirectUrl, array $scope, array $params = [], $separator = '&')
{
    $state = $this->pseudoRandomStringGenerator->getPseudoRandomString(static::CSRF_LENGTH);
    $this->persistentDataHandler->set('state', $state);

    return $this->oAuth2Client->getAuthorizationUrl($redirectUrl, $state, $scope, $params, $separator);
}

```

into (I add Session::put('state', $state);)

```
private function makeUrl($redirectUrl, array $scope, array $params = [], $separator = '&')
{
    $state = $this->pseudoRandomStringGenerator->getPseudoRandomString(static::CSRF_LENGTH);
    $this->persistentDataHandler->set('state', $state);
    Session::put('state', $state);
    return $this->oAuth2Client->getAuthorizationUrl($redirectUrl, $state, $scope, $params, $separator);
}

```

and on line 234, I change this script:

```
protected function validateCsrf()
{
    $state = $this->getState();
    $savedState = $this->persistentDataHandler->get('state');

    if (!$state || !$savedState) {
        throw new FacebookSDKException('Cross-site request forgery validation failed. Required param "state" missing.');
    }

    $savedLen = strlen($savedState);
    $givenLen = strlen($state);

    if ($savedLen !== $givenLen) {
        throw new FacebookSDKException('Cross-site request forgery validation failed. The "state" param from the URL and session do not match.');
    }

    $result = 0;
    for ($i = 0; $i < $savedLen; $i++) {
        $result |= ord($state[$i]) ^ ord($savedState[$i]);
    }

    if ($result !== 0) {
        throw new FacebookSDKException('Cross-site request forgery validation failed. The "state" param from the URL and session do not match.');
    }
}

```

into (I added $this-&gt;persistentDataHandler-&gt;set('state', Session::get('state'));)

```
protected function validateCsrf()
{
    $state = $this->getState();
    $this->persistentDataHandler->set('state', Session::get('state'));
    $savedState = $this->persistentDataHandler->get('state');

    if (!$state || !$savedState) {
        throw new FacebookSDKException('Cross-site request forgery validation failed. Required param "state" missing.');
    }

    $savedLen = strlen($savedState);
    $givenLen = strlen($state);

    if ($savedLen !== $givenLen) {
        throw new FacebookSDKException('Cross-site request forgery validation failed. The "state" param from the URL and session do not match.');
    }

    $result = 0;
    for ($i = 0; $i < $savedLen; $i++) {
        $result |= ord($state[$i]) ^ ord($savedState[$i]);
    }

    if ($result !== 0) {
        throw new FacebookSDKException('Cross-site request forgery validation failed. The "state" param from the URL and session do not match.');
    }
}

```

How to use for Twitter Api
--------------------------

[](#how-to-use-for-twitter-api)

Add this call at the top of the controller:

```
use Jedelhu\Socialpack\SocialpackController;

```

Call function:

```
$result=$social->loginTwitter($data);

```

To get profile info(Includes profile info and images):

```
        $data=array(
            'profile' => "yes",
            );

```

To get tweet:

```
        $data=array(
            'recent_tweets' => array(
                "show" => "yes"
            )
            );

```

To post Tweet:

```
              $data=array(
                   'post_tweet' => array(
                       'show' => "no",
                       'message' => "Test Tweet"
                   )
                   );

```

How to use for Facebook Api
---------------------------

[](#how-to-use-for-facebook-api)

Add this at the top of the controller:

```
use Jedelhu\Socialpack\SocialpackController;

```

Call function( get session in loginFacebook() function):

```
 Session::put('data', $data);

$result=$social->loginFacebook();

```

To get profile info:

```
        $data=array(
            'profile' => "yes",
            );

```

To get Friends:

```
        $data=array(
            'friends' => "yes",
                  );

```

To get Profile Image:

```
             $data=array(
                'profile_image' => "yes",
            );

```

To get published post:

```
             $data=array(
                'published_post' => "yes",
            );

```

To get like pages:

```
             $data=array(
                'like_pages' => "yes",
            );

```

To get all photos:

```
             $data=array(
                'all_photos' => "yes",
            );

```

Post on timeline:

```
             $data=array(
                'post_timeline' => "yes",
                array(
                "show" => "yes",
                "message" => "My post "
                ),
            );

```

Post Image on timeline:

```
             $data=array(
                'post_timeline' => "yes",
                array(
                "show" => "yes",
                "message" => "My post ",
                "url" => ""
                ),
            );

```

Add Article on time line:

```
             $data=array(
                  'post_link_timeline' => "yes",
                            array(
                                "show" => "yes",
                                "link" => "http://www.espn.in/football/european-championship/74/blog/post/2889086/euro-2016s-six-best-group-games-belgium-vs-italy-england-vs-wales-and-more"
                            ),
            );

```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/98219142701e117bdd54d02b2d59fe4f8bed9b5cb877d35d79fac6124f4d9ff3?d=identicon)[jedelhu](/maintainers/jedelhu)

---

Top Contributors

[![jedelhu](https://avatars.githubusercontent.com/u/19818664?v=4)](https://github.com/jedelhu "jedelhu (1 commits)")

### Embed Badge

![Health badge](/badges/jedelhu-socialpack/health.svg)

```
[![Health](https://phpackages.com/badges/jedelhu-socialpack/health.svg)](https://phpackages.com/packages/jedelhu-socialpack)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
