Almost every website which contains a log in option, also contains ways to log in through different social networks. In this series of articles, we will take a look at how we can make sure that our visitor can log in through Google+ and eventually other networks like Twitter and Facebook. In the final article, we will have a close look at how we can make sure users don’t have different accounts due to the fact that they used different social networks.
We will create a framework agnostic package which can easily handle users from different social networks. In this part, we will have a look at our basic setup.
Creating your package
We start by creating our package. For that, we just start a fresh project without any content. We first need to define what our vendor name is. In general, people use their (user)name or company name. I will use PeterNijssen
as my vendor name.
Next to that, we also need a package name. This name normally describes your package. Since we are using social networks to log in with, we will use SocialLogin
as our package name.
It’s time to create our directory structure. In general, it’s recommended to store your classes in the src
directory. So let’s start by creating the directory src/PeterNijssen/SocialLogin
.
We are going to create a composer.json
file, to easily maintain our dependencies.
{
"name": "peternijssen/social-login",
"type": "library",
"description": "Social login functionality",
"homepage": "https://www.peternijssen.nl",
"license": "MIT",
"authors": [
{
"name": "Peter Nijssen",
"homepage": "https://www.peternijssen.nl"
}
],
"require": {
"php": ">=5.3.0"
},
"autoload": {
"psr-0": { "PeterNijssen\\SocialLogin": "src" }
},
"target-dir": "PeterNijssen/SocialLogin"
}
To make sure we didn’t make any mistakes, run composer validate
against the composer.json
file.
Continue reading %Social Network Authentication: Setup%
more
{ 0 comments... » Social Network Authentication: Setup read them below or add one }
Post a Comment