From 671d64fcbea3424d0647b0e64354d651047be277 Mon Sep 17 00:00:00 2001 From: Denis Efremov Date: Sun, 14 Apr 2019 09:17:35 +0300 Subject: [PATCH 1/7] Update README.md --- README.md | 90 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 48 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index b23b2b4..a7f763b 100644 --- a/README.md +++ b/README.md @@ -13,46 +13,50 @@ You can see [base example](https://github.com/itlessons/php-social/tree/master/e Auth in vk.com: - // config.php - $APP_ID_VK = -1; // app id - $APP_SECRET_VK = 'some secret code'; - $APP_SCOPE_VK = ''; //some permissions - $REDIRECT_URL_VK = 'http://domain.ltd/auth_callback_vk.php'; - - - // auth_vk.php - require __DIR__.'/config.php'; - $auth = new \Social\Auth\AuthVk($APP_ID_VK, $APP_SECRET_VK, $APP_SCOPE_VK); - $url = $auth->getAuthorizeUrl($REDIRECT_URL_VK); - stopAndRedirect($url); +```php +// config.php +$APP_ID_VK = -1; // app id +$APP_SECRET_VK = 'some secret code'; +$APP_SCOPE_VK = ''; //some permissions +$REDIRECT_URL_VK = 'http://domain.ltd/auth_callback_vk.php'; +``` + +```php +// auth_vk.php +require __DIR__.'/config.php'; +$auth = new \Social\Auth\AuthVk($APP_ID_VK, $APP_SECRET_VK, $APP_SCOPE_VK); +$url = $auth->getAuthorizeUrl($REDIRECT_URL_VK); +stopAndRedirect($url); +``` Now create callback file and get first api call: - // auth_callback_vk.php - require __DIR__.'/config.php'; - $auth = new \Social\Auth\AuthVk($APP_ID_VK, $APP_SECRET_VK, $APP_SCOPE_VK); - $token = $auth->authenticate($_REQUEST, $REDIRECT_URL_VK); - - if($token == null){ - var_dump($auth->getError()); - //exit - } - - //call api with access_token - $api = new \Social\Api\ApiVk($token); - $user = $api->getProfile(); - - //use user data - - // $user->id - // $user->firstName - // $user->lastName - // $user->nickname - // $user->screenName - // $user->photoUrl - // $user->photoBigUrl - // ... - +```php +// auth_callback_vk.php +require __DIR__.'/config.php'; +$auth = new \Social\Auth\AuthVk($APP_ID_VK, $APP_SECRET_VK, $APP_SCOPE_VK); +$token = $auth->authenticate($_REQUEST, $REDIRECT_URL_VK); + +if($token == null){ + var_dump($auth->getError()); + //exit +} + +//call api with access_token +$api = new \Social\Api\ApiVk($token); +$user = $api->getProfile(); + +//use user data + +// $user->id +// $user->firstName +// $user->lastName +// $user->nickname +// $user->screenName +// $user->photoUrl +// $user->photoBigUrl +// ... +``` Installation ------------ @@ -61,11 +65,13 @@ The recommended way to install php-social is through [Composer][_Composer]. Just ``composer.json`` file and run the ``php composer.phar install`` command to install it: - { - "require": { - "itlessons/php-social": "*" - } +```json +{ + "require": { + "itlessons/php-social": "*" } +} +``` Alternatively, you can download the [php-social.zip][_php-social.zip] file and extract it. @@ -78,4 +84,4 @@ Read [_Composer]: http://getcomposer.org -[_php-social.zip]: https://github.com/itlessons/php-social/archive/master.zip \ No newline at end of file +[_php-social.zip]: https://github.com/itlessons/php-social/archive/master.zip From a2fbffa03f5a30dfdeb66fa5d28c8a60eea87a90 Mon Sep 17 00:00:00 2001 From: Denis Efremov Date: Sun, 14 Apr 2019 09:18:14 +0300 Subject: [PATCH 2/7] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index a7f763b..67da3d1 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,7 @@ $APP_ID_VK = -1; // app id $APP_SECRET_VK = 'some secret code'; $APP_SCOPE_VK = ''; //some permissions $REDIRECT_URL_VK = 'http://domain.ltd/auth_callback_vk.php'; -``` -```php // auth_vk.php require __DIR__.'/config.php'; $auth = new \Social\Auth\AuthVk($APP_ID_VK, $APP_SECRET_VK, $APP_SCOPE_VK); From 4ad3884b85bae9e1f8ddbd4270b43eee29248781 Mon Sep 17 00:00:00 2001 From: Denis Efremov Date: Sun, 14 Apr 2019 09:32:24 +0300 Subject: [PATCH 3/7] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 67da3d1..b0d46e0 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,12 @@ install it: } ``` +Or you can use the console command: + +```sh +$ composer require itlessons/php-social +``` + Alternatively, you can download the [php-social.zip][_php-social.zip] file and extract it. Read From 2cf0ae713601fbdb14ff2971e97271a486e2c875 Mon Sep 17 00:00:00 2001 From: Denis Efremov Date: Sun, 14 Apr 2019 09:33:49 +0300 Subject: [PATCH 4/7] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b0d46e0..389f929 100644 --- a/README.md +++ b/README.md @@ -82,10 +82,10 @@ Alternatively, you can download the [php-social.zip][_php-social.zip] file and e Read ---- - * [Авторизация с помощью OAuth 2.0 в Вконтакте, Моем мире и Facebook] (http://www.itlessons.info/php/auth-with-oauth2-in-vk-mailru-facebook/) - * [Авторизация на вашем сайте с помощью Github] (http://www.itlessons.info/php/auth-with-oauth2-in-github/) - * [Авторизация и работа с Twitter Api через OAuth] (http://www.itlessons.info/php/twitter-oauth-login-and-api/) + * [Авторизация с помощью OAuth 2.0 в Вконтакте, Моем мире и Facebook](http://www.itlessons.info/php/auth-with-oauth2-in-vk-mailru-facebook/) + * [Авторизация на вашем сайте с помощью Github](http://www.itlessons.info/php/auth-with-oauth2-in-github/) + * [Авторизация и работа с Twitter Api через OAuth](http://www.itlessons.info/php/twitter-oauth-login-and-api/) -[_Composer]: http://getcomposer.org -[_php-social.zip]: https://github.com/itlessons/php-social/archive/master.zip +[\_Composer](http://getcomposer.org) +[\_php-social.zip](https://github.com/itlessons/php-social/archive/master.zip) From d620b22e5509d5c9b8d0b59e8df019d297d16f75 Mon Sep 17 00:00:00 2001 From: Denis Efremov Date: Sun, 14 Apr 2019 09:37:01 +0300 Subject: [PATCH 5/7] Update README.md --- README.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 389f929..0332e14 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,18 @@ -php-social +# php-social + ========== +## Brief + +----- + The library to make work with social networks easy. They can auth with OAuth 2.0 or OAuth 1+ protocols and retrieve user profile info. Support Vkontakte, Facebook, Twitter, Github, MailRu. Works with PHP 5.3.3 or later. -Usage +## Usage + ----- You can see [base example](https://github.com/itlessons/php-social/tree/master/examples/base). @@ -56,11 +62,11 @@ $user = $api->getProfile(); // ... ``` -Installation +## Installation ------------ The recommended way to install php-social is through [Composer][_Composer]. Just create a -``composer.json`` file and run the ``php composer.phar install`` command to +`composer.json` file and run the `php composer.phar install` command to install it: ```json @@ -71,7 +77,7 @@ install it: } ``` -Or you can use the console command: +Or you can use the console command from your project root folder: ```sh $ composer require itlessons/php-social From 51a4429fe51e6a862ef3a101f57266c3fb0f7c20 Mon Sep 17 00:00:00 2001 From: Denis Efremov Date: Sun, 14 Apr 2019 09:38:56 +0300 Subject: [PATCH 6/7] Update README.md --- README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0332e14..22be4e2 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ $user = $api->getProfile(); ## Installation ------------ -The recommended way to install php-social is through [Composer][_Composer]. Just create a +The recommended way to install php-social is through [Composer](http://getcomposer.org). Just create a `composer.json` file and run the `php composer.phar install` command to install it: @@ -83,7 +83,7 @@ Or you can use the console command from your project root folder: $ composer require itlessons/php-social ``` -Alternatively, you can download the [php-social.zip][_php-social.zip] file and extract it. +Alternatively, you can download the [php-social.zip](https://github.com/itlessons/php-social/archive/master.zip) file and extract it. Read ---- @@ -92,6 +92,3 @@ Read * [Авторизация на вашем сайте с помощью Github](http://www.itlessons.info/php/auth-with-oauth2-in-github/) * [Авторизация и работа с Twitter Api через OAuth](http://www.itlessons.info/php/twitter-oauth-login-and-api/) - -[\_Composer](http://getcomposer.org) -[\_php-social.zip](https://github.com/itlessons/php-social/archive/master.zip) From e4eb1f3e89266952b1bfebf95123aaf8398128ea Mon Sep 17 00:00:00 2001 From: Denis Efremov Date: Sun, 14 Apr 2019 09:39:47 +0300 Subject: [PATCH 7/7] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 22be4e2..5597f25 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # php-social +> itlessons/php-social + ========== ## Brief