PHPackages                             maer/google-auth - 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. maer/google-auth

Abandoned → [maer/oauth2-simple-client](/?search=maer%2Foauth2-simple-client)Library[Authentication &amp; Authorization](/categories/authentication)

maer/google-auth
================

Laravel 4 wrapper for the league/oauth2-client package. Simple white/blacklist specific e-mails or entire domains.

0.5.0(11y ago)394PHPPHP &gt;=5.4.0

Since Apr 18Pushed 11y ago1 watchersCompare

[ Source](https://github.com/magnus-eriksson/google-auth)[ Packagist](https://packagist.org/packages/maer/google-auth)[ RSS](/packages/maer-google-auth/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (2)Versions (8)Used By (0)

Google Auth for Laravel 4
=========================

[](#google-auth-for-laravel-4)

Add Google auth quick and painless in your Laravel 4 application. It is basically a wrapper for the [thephpleague/oauth2-client](https://github.com/thephpleague/oauth2-client) package. The original package is dead simple to use, but this package adds a simple access control.

You can decide which Google accounts/domains are allowed or blocked. Well, I have used this several times anyway and it's been handy. It's as easy as eating pancakes!

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

[](#installation)

Best way is to use [composer](https://getcomposer.org/download/).

Add the following to your `composer.json`:

```
{
    "require": {
        "maer/google-auth": "dev-master"
    }
}

```

You can, and should, change `dev-master` to the current latest.

Setup
-----

[](#setup)

Register the service provider in `app/config/app.php`:

```
'providers' => array(
    'Maer\GoogleAuth\ServiceProvider',
)
```

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

[](#configuration)

Publish and edit the configuration file

```
$ php artisan config:publish maer/google-auth
```

Edit the `app/config/packages/maer/google-auth/config.php`:

```
return array(

    'client_id'    => 'YOUR_GOOGLE_CLIENT_ID',
    'secret'       => 'YOUR_GOOGLE_CLIENT_SECRET',
    'callback_url' => 'YOUR_GOOGLE_CLIENT_CALLBACK_URL',

    /*
    * Allowed accounts
    * -------------------------------------
    * Enter full e-mail addresses or entire domains.
    * If empty, all e-mail addresses will be allowed.
    */
    'allow'     => array('your-email@a-domain.com', 'another-domain.com'),

    /*
    * Disallowed accounts
    * -------------------------------------
    * Enter full e-mail addresses or entire domains.
    * If an e-mail or domain is in the allowed and disallowed,
    * it will be blocked.
    */
    'disallow'     => array('not-allowed@another-domain.com'),
);
```

Usage
-----

[](#usage)

This is a simple example of how you use it. You should put this in a controller with depency injection instead.

```
Route::get('/', function()
{
    echo 'Authorize';
});

Route::get('/google-auth', function(){

    // Get the instance of GoogleAuth
    $Auth = App::make('Maer\GoogleAuth\GoogleAuth');

    // This call will redirect the user to Googles Auth screen
    return $Auth->authorize();

});

Route::get('/google-auth/callback', function(){

    // Get the instance of GoogleAuth
    $Auth = App::make('Maer\GoogleAuth\GoogleAuth');

    // If the authorization fails, this method will return null.
    // Now it's up to you to decide what to do with the user object.
    $User = $Auth->callback();

    // You can also ask for the access token, regardless if you use
    // the callback-method or not.
    $token = $Auth->getAccessToken();

});
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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.

###  Release Activity

Cadence

Every ~8 days

Total

6

Last Release

4363d ago

PHP version history (2 changes)0.2PHP &gt;=5.3.0

0.3.0PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1ada6171adca1bf89432dd54fff188ef3d890a71734278bd06b54487f45b5695?d=identicon)[maer](/maintainers/maer)

---

Top Contributors

[![magnus-eriksson](https://avatars.githubusercontent.com/u/3640297?v=4)](https://github.com/magnus-eriksson "magnus-eriksson (25 commits)")

---

Tags

laravelgoogleoauth2

### Embed Badge

![Health badge](/badges/maer-google-auth/health.svg)

```
[![Health](https://phpackages.com/badges/maer-google-auth/health.svg)](https://phpackages.com/packages/maer-google-auth)
```

###  Alternatives

[league/oauth2-google

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

41721.2M118](/packages/league-oauth2-google)[kronthto/laravel-oauth2-login

Provides a middleware to protect resources requiring an OAuth2 login

2117.5k1](/packages/kronthto-laravel-oauth2-login)

PHPackages © 2026

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