Skip to content

Commit

Permalink
Merge pull request #1 from Label84/laravel-11-support
Browse files Browse the repository at this point in the history
Laravel 11 support
  • Loading branch information
tjardoo authored Feb 24, 2024
2 parents 5d95d4a + aaf7d58 commit f3b8e5f
Show file tree
Hide file tree
Showing 17 changed files with 122 additions and 168 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/php-cs-fixer.yml

This file was deleted.

14 changes: 7 additions & 7 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: PHPStan
name: Run PHPStan

on:
push:
paths:
- '**.php'
- 'phpstan.neon.dist'
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
phpstan:
name: phpstan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -20,7 +20,7 @@ jobs:
coverage: none

- name: Install composer dependencies
uses: ramsey/composer-install@v1
uses: ramsey/composer-install@v2

- name: Run PHPStan
run: ./vendor/bin/phpstan --error-format=github
run: ./vendor/bin/phpstan --error-format=github
25 changes: 25 additions & 0 deletions .github/workflows/pint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Run Pint

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
pint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Run Pint
uses: aglipanci/laravel-pint-action@2.3.0

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Fix styling
23 changes: 15 additions & 8 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: run-tests
name: Run tests

on: [push, pull_request]
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
Expand All @@ -10,22 +14,25 @@ jobs:
matrix:
os: [ubuntu-latest]
php: [8.1, 8.2]
laravel: [9.*, 10.*]
laravel: [10.*, 11.*]
dependency-version: [prefer-stable]
include:
- laravel: 9.*
testbench: 7.*
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*
exclude:
- laravel: 11.*
php: 8.1

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v1
uses: actions/checkout@v4

- name: Cache dependencies
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
Expand All @@ -40,7 +47,7 @@ jobs:
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/phpunit
40 changes: 0 additions & 40 deletions .php_cs.dist.php

This file was deleted.

7 changes: 0 additions & 7 deletions CHANGELOG.md

This file was deleted.

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

[![Latest Stable Version](https://poser.pugx.org/label84/laravel-auth-log/v/stable?style=flat-square)](https://packagist.org/packages/label84/laravel-auth-log)
[![MIT Licensed](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
[![Quality Score](https://img.shields.io/scrutinizer/g/label84/laravel-auth-log.svg?style=flat-square)](https://scrutinizer-ci.com/g/label84/laravel-auth-log)
[![Total Downloads](https://img.shields.io/packagist/dt/label84/laravel-auth-log.svg?style=flat-square)](https://packagist.org/packages/label84/laravel-auth-log)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/label84/laravel-auth-log/run-tests.yml?branch=master&style=flat-square)

Expand All @@ -18,8 +17,8 @@ The ``laravel-auth-log`` package will log all the default Laravel authentication

| Version | Release |
|---------|---------|
| 11.x | 1.1 |
| 10.x | 1.1 |
| 9.x | 1.1 |

## Installation

Expand Down
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
}],
"require": {
"php": "^8.0",
"illuminate/support": "^9.0|^10.0",
"illuminate/auth": "^9.0|^10.0",
"illuminate/database": "^9.0|^10.0"
"illuminate/support": "^10.0|^11.0",
"illuminate/auth": "^10.0|^11.0",
"illuminate/database": "^10.0|^11.0"
},
"require-dev": {
"orchestra/testbench": "^7.0|^8.0",
"nunomaduro/larastan": "^2.0"
"orchestra/testbench": "^8.0|^9.0",
"larastan/larastan": "^2.0",
"laravel/pint": "^1.14"
},
"extra": {
"laravel": {
Expand Down
12 changes: 5 additions & 7 deletions config/config.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?php

return [
/*
* Enable/Disable the logging to the database.
*/
'enabled' => env('AUTH_LOG_ENABLED', true),

/*
* The database table name.
*/
Expand All @@ -13,15 +18,8 @@
*/
'database_connection' => env('DB_CONNECTION', 'mysql'),

/*
* Enable/Disable the logging to the database.
*/
'enabled' => env('AUTH_LOG_ENABLED', true),

/*
* All events that the package will log to the database.
*
* You can comment out (//) the events that you don't want to log.
*/
'events' => [
\Illuminate\Auth\Events\Attempting::class,
Expand Down
5 changes: 2 additions & 3 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
includes:
- ./vendor/nunomaduro/larastan/extension.neon
- ./vendor/larastan/larastan/extension.neon

parameters:

paths:
- src

# The level 9 is the highest level
level: 8

ignoreErrors:

excludePaths:

checkMissingIterableValueType: false
checkMissingIterableValueType: false
28 changes: 10 additions & 18 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<testsuites>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="Test Suite">
<directory suffix="Test.php">./tests</directory>
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<php>
<env name="DB_CONNECTION" value="testing"/>
<server name="DB_DATABASE" value=":memory:"/>
</php>
</phpunit>
</testsuites>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion src/AuthLogServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function boot(): void
{
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/../config/config.php' => config_path('authlog.php'),
__DIR__.'/../config/config.php' => config_path('authlog.php'),
], 'config');
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Listeners/LogAuthAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
class LogAuthAction
{
/** @param mixed $event */
public function handle($event, array $context = null): void
public function handle($event, ?array $context = null): void
{
if (config('authlog.enabled') == false) {
return;
}

if (!in_array(get_class($event), config('authlog.events'))) {
if (! in_array(get_class($event), config('authlog.events'))) {
return;
}

Expand Down
3 changes: 1 addition & 2 deletions tests/Custom/CustomEventsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public function setUp(): void
parent::setUp();
}

/** @test */
public function it_can_add_context_to_the_database_record()
public function test_it_can_add_context_to_the_database_record()
{
$event = new \Illuminate\Auth\Events\Login('web', $this->user, false);

Expand Down
Loading

0 comments on commit f3b8e5f

Please sign in to comment.