Download the PHP package simplon/gplus without Composer

On this page you can find all versions of the php package simplon/gplus. 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 gplus

     _                 _                           _
 ___(_)_ __ ___  _ __ | | ___  _ __     __ _ _ __ | |_   _ ___
/ __| | '_ ` _ \| '_ \| |/ _ \| '_ \   / _` | '_ \| | | | / __|
\__ \ | | | | | | |_) | | (_) | | | | | (_| | |_) | | |_| \__ \
|___/_|_| |_| |_| .__/|_|\___/|_| |_|  \__, | .__/|_|\__,_|___/
                |_|                    |___/|_|

Simplon/Gplus

  1. Installing
  2. Setup Gplus module
    2.1. Create authentication container
    2.2. Create Gplus module instance
  3. Usage
    3.1. Request authentication url
    3.2. Request AccessToken
    3.3. Read user profile data
    3.4. Refresh AccessToken manually
  4. Full example

Dependecies


1. Installing

Install easy via composer:


2. Setup Gplus module

For all calls we wanna make we need to initialise our Gplus module with our . If you happen to miss these credentials hop over to Google's console and create them.

2.1. Create authentication container

We use a value object to hold our credentials. I love value objects because of their clear communication what kind of data they hold.

Enforce authentication prompt: By default Google determines automatically if the has to approve your app. This means that the first time the user will see a prompt while on the second time the user would be directly redirected to the given .

For testing purposes I found it ideal to enforce the constant appearance of the prompt upon authentication. To enable this the following should work just fine:

2.2. Create Gplus module instance

Alright, now that we have our we can proceed to create our instance.


3. Usage

This scenario shows an authentication flow initialised via the server. If you happen to have already an and you can jump straight to point .

Remember: We need the prior created Gplus instance in order to interact with Google's API.

3.1. Request authentication url

We need an which we can pass to a web client which in turn should open it. We also need to tell Google for which scopes we request permission. Here is a list of possible scopes.

For this example we will request access to the and his/her . Note: In the following example I use a set of which helps me to avoid typos etc. I suggest you do the same since it helps you to keep track of data within your code.

Now, lets fetch the . This URL should be passed to the web client which redirects the user to Google's authentication process.

3.2. Request AccessToken

When everything went fine Google will redirect to our prior defined with a GET parameter named which is attached to the url. We will use this code now to exchange it for a valid .

If everything went fine we will receive a bunch of data via which is another value object. Actually we are mostly interested in only two variables: and its .

The will give us access to the requested while the will renew the as soon as it ended its life time (2 hours). Therefore, its important to save both tokens and never to lose the .

3.3. Read user profile data

In order to read a user's profile data we need the aforementioned tokens:

If the call succeeds you will receive a which holds all basic profile data:

There is still a bunch of data left which can be accessed as array via . If the is not valid anymore the method will automatically try to renew it by the help of the . In case of failure you will receive a .

3.4. Refresh AccessToken manually

In order to receive a fresh you should call the following method. If the call succeeds you will receive which holds among other things a fresh accessToken - .

In case of a unsuccessful call you will either receive or an .


4. Full example

Following a full length example of the above described process flow:

License

Cirrus is freely distributable under the terms of the MIT license.

Copyright (c) 2014 Tino Ehrich ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Bitdeli Badge


All versions of gplus with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
fightbulc/php_curl Version 1.0.*
simplon/helper Version 0.6.*
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 simplon/gplus contains the following files

Loading the files please wait ....