Skip to content

Commit 8c6d45a

Browse files
committed
wip
0 parents  commit 8c6d45a

24 files changed

+656
-0
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2

.gitattributes

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
# Ignore all test and documentation with "export-ignore".
5+
/.github export-ignore
6+
/.gitattributes export-ignore
7+
/.gitignore export-ignore
8+
/phpunit.xml.dist export-ignore
9+
/art export-ignore
10+
/docs export-ignore
11+
/tests export-ignore
12+
/.editorconfig export-ignore
13+
/.php_cs.dist.php export-ignore
14+
/psalm.xml export-ignore
15+
/psalm.xml.dist export-ignore
16+
/testbench.yaml export-ignore
17+
/UPGRADING.md export-ignore
18+
/phpstan.neon.dist export-ignore
19+
/phpstan-baseline.neon export-ignore
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Fix PHP code style issues
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
8+
jobs:
9+
php-code-styling:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
with:
16+
ref: ${{ github.head_ref }}
17+
18+
- name: Fix PHP code style issues
19+
uses: aglipanci/[email protected]
20+
21+
- name: Commit changes
22+
uses: stefanzweifel/git-auto-commit-action@v4
23+
with:
24+
commit_message: formatting

.github/workflows/run-tests.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: run-tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: true
14+
matrix:
15+
os: [ubuntu-latest, windows-latest]
16+
php: [8.2, 8.1]
17+
laravel: [9.*]
18+
stability: [prefer-lowest, prefer-stable]
19+
include:
20+
- laravel: 9.*
21+
testbench: 7.*
22+
23+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v3
28+
29+
- name: Setup PHP
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: ${{ matrix.php }}
33+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
34+
coverage: none
35+
36+
- name: Setup problem matchers
37+
run: |
38+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
39+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
40+
41+
- name: Install dependencies
42+
run: |
43+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
44+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
45+
46+
- name: List Installed Dependencies
47+
run: composer show -D
48+
49+
- name: Execute tests
50+
run: vendor/bin/pest

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.idea
2+
.phpunit.result.cache
3+
build
4+
composer.lock
5+
coverage
6+
docs
7+
phpunit.xml
8+
phpstan.neon
9+
testbench.yaml
10+
vendor
11+
node_modules

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Changelog
2+
3+
All notable changes to `laravel-otp` will be documented in this file.

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) chrysanthos <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

composer.json

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"name": "chrysanthos/laravel-otp",
3+
"description": "Login Otp for Laravel",
4+
"keywords": [
5+
"chrysanthos",
6+
"laravel",
7+
"laravel-otp"
8+
],
9+
"homepage": "https://github.com/chrysanthos/laravel-otp",
10+
"license": "MIT",
11+
"authors": [
12+
{
13+
"name": "Chrysanthos Prodromou",
14+
"email": "[email protected]",
15+
"role": "Developer"
16+
}
17+
],
18+
"require": {
19+
"php": "^8.1",
20+
"illuminate/contracts": "^9.0",
21+
"laravel/framework": "^9.41",
22+
"spatie/laravel-package-tools": "^1.13.0"
23+
},
24+
"require-dev": {
25+
"laravel/pint": "^1.0",
26+
"nunomaduro/collision": "^6.0",
27+
"nunomaduro/larastan": "^2.0.1",
28+
"orchestra/testbench": "^7.0",
29+
"pestphp/pest": "^1.21",
30+
"pestphp/pest-plugin-laravel": "^1.1",
31+
"phpstan/extension-installer": "^1.1",
32+
"phpstan/phpstan-deprecation-rules": "^1.0",
33+
"phpstan/phpstan-phpunit": "^1.0",
34+
"phpunit/phpunit": "^9.5"
35+
},
36+
"autoload": {
37+
"psr-4": {
38+
"Chrysanthos\\LaravelOtp\\": "src",
39+
"Chrysanthos\\LaravelOtp\\Database\\Factories\\": "database/factories"
40+
}
41+
},
42+
"autoload-dev": {
43+
"psr-4": {
44+
"Chrysanthos\\LaravelOtp\\Tests\\": "tests"
45+
}
46+
},
47+
"scripts": {
48+
"post-autoload-dump": "@php ./vendor/bin/testbench package:discover --ansi",
49+
"analyse": "vendor/bin/phpstan analyse",
50+
"test": "vendor/bin/pest",
51+
"test-coverage": "vendor/bin/pest --coverage",
52+
"format": "vendor/bin/pint"
53+
},
54+
"config": {
55+
"sort-packages": true,
56+
"allow-plugins": {
57+
"pestphp/pest-plugin": true,
58+
"phpstan/extension-installer": true
59+
}
60+
},
61+
"extra": {
62+
"laravel": {
63+
"providers": [
64+
"Chrysanthos\\LaravelOtp\\LaravelOtpServiceProvider"
65+
],
66+
"aliases": {
67+
"LaravelOtp": "Chrysanthos\\LaravelOtp\\Facades\\LaravelOtp"
68+
}
69+
}
70+
},
71+
"minimum-stability": "dev",
72+
"prefer-stable": true
73+
}

config/otp.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
return [
4+
5+
'enabled' => false,
6+
7+
'notification' => \Chrysanthos\LaravelOtp\Notifications\SendOtpToUserNotification::class,
8+
9+
];

phpunit.xml.dist

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5+
backupGlobals="false"
6+
backupStaticAttributes="false"
7+
bootstrap="vendor/autoload.php"
8+
colors="true"
9+
convertErrorsToExceptions="true"
10+
convertNoticesToExceptions="true"
11+
convertWarningsToExceptions="true"
12+
processIsolation="false"
13+
stopOnFailure="false"
14+
executionOrder="random"
15+
failOnWarning="true"
16+
failOnRisky="true"
17+
failOnEmptyTestSuite="true"
18+
beStrictAboutOutputDuringTests="true"
19+
verbose="true"
20+
>
21+
<testsuites>
22+
<testsuite name="Chrysanthos Test Suite">
23+
<directory>tests</directory>
24+
</testsuite>
25+
</testsuites>
26+
<coverage>
27+
<include>
28+
<directory suffix=".php">./src</directory>
29+
</include>
30+
<report>
31+
<html outputDirectory="build/coverage"/>
32+
<text outputFile="build/coverage.txt"/>
33+
<clover outputFile="build/logs/clover.xml"/>
34+
</report>
35+
</coverage>
36+
<logging>
37+
<junit outputFile="build/report.junit.xml"/>
38+
</logging>
39+
</phpunit>

0 commit comments

Comments
 (0)