Download the PHP package mmanos/laravel-social without Composer

On this page you can find all versions of the php package mmanos/laravel-social. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-social

Social Login Package for Laravel 4

This package is a Laravel 4 service provider for Lusitanian/PHPoAuthLib which provides oAuth support in PHP 5.3+ and is very easy to integrate with any project which requires an oAuth client.

In addition, you may take advantage of the optional controller and model to make it very easy to:

Supported Services

See the documentation for Lusitanian/PHPoAuthLib for the list of supported services.

Installation Via Composer

Add this to your composer.json file, in the require object:

After that, run composer install to install the package.

Add the service provider to app/config/app.php, within the providers array.

Add a class alias to app/config/app.php, within the aliases array.

Configuration

Publish the default config file to your application so you can make modifications.

Add your service provider credentials to the published config file: app/config/packages/mmanos/laravel-social/config.php

Basic Usage

Obtain a service class object for a provider.

Optionally, add a second parameter with the URL which the service needs to redirect to, otherwise it will redirect to the current URL.

Redirect the user to the oAuth log in page for a provider.

For examples of how to integrate with a specific provider, see here.

Using The Provided Controller And Model

For added convenience, use the built-in controller and model to easily log in or connect with a social provider account.

Requirements

This implementation is fairly opinionated and assumes that you want to allow your users to log in or sign up seamlessly with their existing social provider account and associate that social provider account with an existing user record.

It has these requirements:

Migration

Publish and run the database migrations for this package. This will create a user_providers table.

Note: You can change the default table name used to store the user provider information by changing the value of the table key in the config file.

Model Setup

Add the SocialTrait to your User model definition.

Social Login Flow

Simply create a link to the built-in controller to initiate a log in flow. The user will be redirected to the provider login page before they return to your website.

If an existing user is already linked to the provider account, they will be logged in as that user.

If an existing user is not found for the provider account, a new user record will be created and then a link to the provider account will be made before they are logged in as that user.

To customize where the user is redirected to after the log in flow, add onsuccess and onerror parameters.

Note: The default redirect location is to the referer header. Otherwise /.

Connecting A Social Account Flow

You can also associate a social provider account to an existing user if they are already logged in.

Note: This action also supports the onsuccess and onerror parameters.

Working With Users And Providers

You can fetch all providers linked to a user.

You can check to see if a user is connected to a given provider.

You can fetch a single provider instance for a user.

This package stores an encrypted version of the access_token for each user provider. That way you can easily make API calls to the provider service on behalf of the user.

Note: Keep in mind it is possible for an access_token to expire. You can refresh a user's access_token by initiating a redirect to the getConnect action in the controller.

Create User Logic

If you want to customize the logic used to create a user during the social login flow, modify the create_user key in the config file.

Note: Make sure to return a numeric primary key when finished.

Note: The information passed in the $data parameter is the data returned from the fetch_user_info functions for each provider in the config file.

Provider User Information

To customize which data you want to retrieve from a social provider account, modify the fetch_user_info key for each provider in the config file.

Note: This function also allows you to normalize the user data returned by each of the social providers by mapping their fields to fields you want to store in your user record.

New User Validation

You can configure the social login flow to validate the user information returned by the social provider. This way you can ensure that all of the data you require for a new user is properly obtained and in the correct format.

To customize the validation rules, modify the user_validation key in the config file.

Note: You may also declare a closure function to create and return a Validator instance for greater flexibility.

Social Buttons

This package provides some convenient css that allows you to create nice social buttons. It is built for use with the Twitter Bootstrap and Font Awesome frameworks.

Publish The Assets

Publish the public assets for this package.

Include The Assets

Building Buttons

See here for a list of supported class names.


All versions of laravel-social with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version >=4.1
lusitanian/oauth Version ~0.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mmanos/laravel-social contains the following files

Loading the files please wait ....