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

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

martenb/google
==============

Ultra easy-to-use Google login wrapper for \[`Nette Framework`\](https://github.com/nette/).

v0.1.5(7y ago)131MITPHPPHP &gt;= 7.1

Since Feb 26Pushed 7y ago1 watchersCompare

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

READMEChangelogDependencies (4)Versions (7)Used By (0)

Google
======

[](#google)

Inspired by

---

[![Build Status](https://camo.githubusercontent.com/5abb76700c6babe1c4abe1e7a4f208aa2b27905d6b29c3ba8c89cee080b3e44d/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6d617274656e622f676f6f676c652e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/martenb/google)[![Code coverage](https://camo.githubusercontent.com/e20146fab1f170cbeddd6b4a77dee2ce2c055eb43399ffc58300be76856128de/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6d617274656e622f676f6f676c652e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/r/martenb/google)[![Licence](https://camo.githubusercontent.com/1e279ee779d1e3ad6d11a13c4e8a59312a1830322e5cc8468bffd542b52fec5d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d617274656e622f676f6f676c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/martenb/google)[![Downloads this Month](https://camo.githubusercontent.com/9bc9f15fb02760fe1a5daeed8f683117ca0d91245b579391c159c6e2ac852b64/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6d617274656e622f676f6f676c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/martenb/google)[![Downloads total](https://camo.githubusercontent.com/945d2ba4b048119700e9a48f41a9d31528a91446ad2ba557439b91ee4ad9f22f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d617274656e622f676f6f676c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/martenb/google)[![Latest stable](https://camo.githubusercontent.com/11476e2ca239526646db00cc171e0ef9f86a158333527b7d175f0457760c936c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d617274656e622f676f6f676c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/martenb/google)[![PHPStan](https://camo.githubusercontent.com/441b5874ce4df0a2defc892979c96c46889b69cb32119d04f0b48626349f8bc9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d656e61626c65642d627269676874677265656e2e7376673f7374796c653d666c6174)](https://github.com/phpstan/phpstan)

Content
-------

[](#content)

- [Requirements - what do you need](#requirements)
- [Installation - how to register an extension](#installation)
- [Usage - how to use it](#usage)

Requirements
------------

[](#requirements)

You need to create a Google project and supply these parameters:

- **clientId**
- **clientSecret**

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

[](#installation)

```
extensions:
    google: MartenB\Google\DI\Nette\GoogleExtension

google:
    clientId: %yourClientId%
    clientSecret: %yourClientSecret%
```

Usage
-----

[](#usage)

Simple example how to use Google Login in Presenter

```
namespace App\Presenters;

use Google_Service_Oauth2;
use InvalidArgumentException;
use MartenB\Google\GoogleLogin;
use Nette\Application\Responses\RedirectResponse;
use Nette\Application\UI\Presenter;
use Nette\Security\AuthenticationException;

final class SignPresenter extends Presenter
{

    /** @var GoogleLogin @inject */
    public $googleLogin;

    public function actionGoogle()
    {
        // Redirect to Google and ask customer to grant access to his account
        $url = $this->googleLogin->getLoginUrl($this->link('//googleAuthorize'), [Google_Service_Oauth2::USERINFO_PROFILE, Google_Service_Oauth2::USERINFO_EMAIL]);
        $this->sendResponse(new RedirectResponse($url));
    }

    /**
     * Log in user with accessToken obtained after redirected from Google
     *
     * @param $code
     * @return void
     */
    public function actionGoogleAuthorize($code)
    {
        // Fetch User data from Google and try to login
        try {
            $token = $this->googleLogin->getAccessToken($this->link('//googleAuthorize'), $code);

            $this->user->login('google', $this->googleLogin->getMe($token));
            $this->flashMessage('Login successful :-).', 'success');

        } catch (InvalidArgumentException | AuthenticationException $e) {
            $this->flashMessage('Login failed. :-( Try again.', 'danger');

        }
    }

}
```

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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 ~1 days

Total

6

Last Release

2676d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13311472?v=4)[Martin Brettschneider](/maintainers/martenb)[@martenb](https://github.com/martenb)

---

Top Contributors

[![martenb](https://avatars.githubusercontent.com/u/13311472?v=4)](https://github.com/martenb "martenb (11 commits)")

---

Tags

phpsdkgooglenetteoauth2login

### Embed Badge

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

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

PHPackages © 2026

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