Skip to content

Commit

Permalink
Laravel 9
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Feb 14, 2022
1 parent 68de755 commit 1512670
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 73 deletions.
49 changes: 49 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

return (new PhpCsFixer\Config())
->setRules([
'@PSR12' => true,
'binary_operator_spaces' => true,
'blank_line_after_opening_tag' => true,
'compact_nullable_typehint' => true,
'declare_equal_normalize' => true,
'lowercase_cast' => true,
'lowercase_static_reference' => true,
'new_with_braces' => true,
'no_blank_lines_after_class_opening' => true,
'no_leading_import_slash' => true,
'no_whitespace_in_blank_line' => true,
'no_unused_imports' => true,
'ordered_class_elements' => [
'order' => [
'use_trait',
],
],
'ordered_imports' => [
'imports_order' => [
'class',
'function',
'const',
],
'sort_algorithm' => 'none',
],
'return_type_declaration' => true,
'short_scalar_cast' => true,
'single_blank_line_before_namespace' => true,
'single_trait_insert_per_statement' => true,
'ternary_operator_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => [
'elements' => [
'const',
'method',
'property',
],
],
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('vendor')
->in([__DIR__.'/src/', __DIR__.'/tests/'])
)
;
16 changes: 0 additions & 16 deletions .php_cs

This file was deleted.

19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
<h1 align="center"> Laravel-socialite </h1>
# Laravel Socialite

![Laravel Octane Ready Status](https://img.shields.io/badge/Octance-ready-green?style=flat-square)
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/overtrue/laravel-socialite?style=flat-square)
![GitHub License](https://img.shields.io/github/license/overtrue/laravel-socialite?style=flat-square)
![Packagist Downloads](https://img.shields.io/packagist/dt/overtrue/laravel-socialite?style=flat-square)

[![Sponsor me](https://github.com/overtrue/overtrue/blob/master/sponsor-me-button-s.svg?raw=true)](https://github.com/sponsors/overtrue)

# Installation

```
$ composer require "overtrue/laravel-socialite:~3.0"
$ composer require "overtrue/laravel-socialite"
```

> if you have been installed the `overtrue/socialite` package, please remove it from `composer.json` before this command.
# Configuration

1. You will also need to add credentials for the OAuth services your application utilizes. These credentials should be placed in your `config/socialite.php` or `config/services.php` configuration file, and should use the key facebook, twitter, linkedin, google, github or bitbucket, depending on the providers your application requires. For example:
```php

```php
<?php

return [
Expand All @@ -24,7 +31,7 @@ $ composer require "overtrue/laravel-socialite:~3.0"
],
//...
];
```
```

# Usage

Expand Down Expand Up @@ -70,14 +77,12 @@ Route::get('/oauth/github/callback', 'AuthController@handleProviderCallback');

About more usage, please refer to [overtrue/socialite](https://github.com/overtrue/socialite).


## :heart: Sponsor me
## :heart: Sponsor me

[![Sponsor me](https://github.com/overtrue/overtrue/blob/master/sponsor-me.svg?raw=true)](https://github.com/sponsors/overtrue)

如果你喜欢我的项目并想支持它,[点击这里 :heart:](https://github.com/sponsors/overtrue)


## Project supported by JetBrains

Many thanks to Jetbrains for kindly providing a license for me to work on this and other open-source projects.
Expand Down
84 changes: 59 additions & 25 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,63 @@
{
"name": "overtrue/laravel-socialite",
"description": "Social OAuth authentication for Laravel 5.",
"require": {
"overtrue/socialite": "~3.0"
},
"autoload": {
"psr-4": {
"Overtrue\\LaravelSocialite\\": "src/"
}
"name": "overtrue/laravel-socialite",
"description": "Social OAuth authentication for Laravel 5.",
"require": {
"overtrue/socialite": "^4.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"mockery/mockery": "^1.4",
"friendsofphp/php-cs-fixer": "^3.3"
},
"autoload": {
"psr-4": {
"Overtrue\\LaravelSocialite\\": "src/"
}
},
"license": "MIT",
"authors": [
{
"name": "overtrue",
"email": "[email protected]"
}
],
"extra": {
"laravel": {
"providers": [
"Overtrue\\LaravelSocialite\\ServiceProvider"
],
"aliases": {
"Socialite": "Overtrue\\LaravelSocialite\\Socialite"
}
},
"license": "MIT",
"authors": [
{
"name": "overtrue",
"email": "[email protected]"
}
],
"extra": {
"laravel": {
"providers": [
"Overtrue\\LaravelSocialite\\ServiceProvider"
],
"aliases": {
"Socialite": "Overtrue\\LaravelSocialite\\Socialite"
}
}
"hooks": {
"pre-commit": [
"composer test",
"composer check-style"
],
"pre-push": [
"composer test",
"composer check-style"
]
}
},
"scripts": {
"post-update-cmd": [
"cghooks update"
],
"post-merge": "composer install",
"post-install-cmd": [
"cghooks add --ignore-lock",
"cghooks update"
],
"cghooks": "vendor/bin/cghooks",
"check-style": "php-cs-fixer fix --using-cache=no --diff --dry-run --ansi",
"fix-style": "php-cs-fixer fix --using-cache=no --ansi",
"test": "vendor/bin/phpunit"
},
"scripts-descriptions": {
"test": "Run all tests.",
"check-style": "Run style checks (only dry run - no fixing!).",
"fix-style": "Run style checks and fix violations."
}
}
18 changes: 1 addition & 17 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,19 @@
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
use Overtrue\Socialite\SocialiteManager;

/**
* Class ServiceProvider.
*/
class ServiceProvider extends LaravelServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;

/**
* Register the provider.
*/
public function register()
{
$this->app->singleton(SocialiteManager::class, function ($app) {
$this->app->singleton(SocialiteManager::class, function () {
$config = array_merge(\config('socialite', []), \config('services', []));

return new SocialiteManager($config);
});
}

/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return [SocialiteManager::class];
Expand Down
8 changes: 0 additions & 8 deletions src/Socialite.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,8 @@

use Illuminate\Support\Facades\Facade;

/**
* Class Socialite.
*/
class Socialite extends Facade
{
/**
* Return the facade accessor.
*
* @return string
*/
public static function getFacadeAccessor()
{
return 'Overtrue\\Socialite\\SocialiteManager';
Expand Down
0 src/.gitkeep → tests/.gitkeep
100755 → 100644
File renamed without changes.

0 comments on commit 1512670

Please sign in to comment.