Skip to content

Commit

Permalink
structure
Browse files Browse the repository at this point in the history
  • Loading branch information
ildyria committed Aug 6, 2024
1 parent 9511d13 commit 8f507ce
Show file tree
Hide file tree
Showing 23 changed files with 536 additions and 1 deletion.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
20 changes: 20 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/phpunit.xml.dist export-ignore
/art export-ignore
/docs export-ignore
/tests export-ignore
/workbench export-ignore
/.editorconfig export-ignore
/.php_cs.dist.php export-ignore
/psalm.xml export-ignore
/psalm.xml.dist export-ignore
/testbench.yaml export-ignore
/UPGRADING.md export-ignore
/phpstan.neon.dist export-ignore
/phpstan-baseline.neon export-ignore
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: LycheeOrg
28 changes: 28 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: PHPStan

on:
push:
paths:
- '**.php'
- 'phpstan.neon'
- '.github/workflows/phpstan.yml'

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none

- name: Install composer dependencies
uses: ramsey/composer-install@v3

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

on:
push:
paths:
- '**.php'
- '.github/workflows/run-tests.yml'
- 'phpunit.xml.dist'
- 'composer.json'
- 'composer.lock'

jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 5
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.3, 8.2]
laravel: [11.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 11.*
testbench: 9.*
carbon: ^2.63

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

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.os == 'windows-latest' && '^^^' || '' }}${{ matrix.carbon }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: List Installed Dependencies
run: composer show -D

- name: Execute tests
run: composer run test
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.idea
.phpunit.cache
build
composer.lock
coverage
docs
phpunit.xml
phpstan.neon
testbench.yaml
vendor
node_modules
1 change: 1 addition & 0 deletions .php-cs-fixer.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"php":"8.3.9","version":"3.61.1:v3.61.1#94a87189f55814e6cabca2d9a33b06de384a2ab8","indent":"\t","lineEnding":"\n","rules":{"align_multiline_comment":true,"array_syntax":true,"backtick_to_shell_exec":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["return"]},"braces_position":{"allow_single_line_anonymous_functions":true,"allow_single_line_empty_anonymous_classes":true},"class_attributes_separation":{"elements":{"method":"one"}},"class_definition":{"single_line":true},"class_reference_name_casing":true,"clean_namespace":true,"concat_space":{"spacing":"one"},"declare_parentheses":true,"echo_tag_syntax":true,"empty_loop_body":{"style":"braces"},"empty_loop_condition":true,"function_declaration":true,"general_phpdoc_tag_rename":{"replacements":{"inheritDocs":"inheritDoc"}},"global_namespace_import":{"import_classes":false,"import_constants":false,"import_functions":false},"include":true,"increment_style":{"style":"post"},"integer_literal_case":true,"lambda_not_used_import":true,"linebreak_after_opening_tag":true,"magic_constant_casing":true,"magic_method_casing":true,"method_argument_space":{"on_multiline":"ignore"},"native_function_casing":true,"native_type_declaration_casing":true,"no_alias_language_construct_call":true,"no_alternative_syntax":true,"no_binary_string":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_extra_blank_lines":{"tokens":["attribute","case","continue","curly_brace_block","default","extra","parenthesis_brace_block","square_brace_block","switch","throw","use"]},"no_leading_namespace_whitespace":true,"no_mixed_echo_print":true,"no_multiline_whitespace_around_double_arrow":true,"no_null_property_initialization":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_around_offset":true,"no_trailing_comma_in_singleline":true,"no_unneeded_braces":{"namespaces":true},"no_unneeded_control_parentheses":{"statements":["break","clone","continue","echo_print","switch_case","yield"]},"no_unneeded_import_alias":true,"no_unset_cast":true,"no_unused_imports":true,"no_useless_concat_operator":true,"no_useless_nullsafe_operator":true,"no_whitespace_before_comma_in_array":true,"normalize_index_brace":true,"nullable_type_declaration_for_default_null_value":true,"object_operator_without_whitespace":true,"operator_linebreak":{"only_booleans":true,"position":"end"},"ordered_imports":{"sort_algorithm":"alpha","imports_order":null},"ordered_types":{"null_adjustment":"always_last","sort_algorithm":"none"},"php_unit_fqcn_annotation":true,"php_unit_method_casing":true,"phpdoc_align":true,"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_inline_tag_normalizer":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":true,"phpdoc_no_package":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_order":{"order":["param","return","throws"]},"phpdoc_return_self_reference":true,"phpdoc_scalar":true,"phpdoc_separation":{"groups":[["Annotation","NamedArgumentConstructor","Target"],["author","copyright","license"],["category","package","subpackage"],["property","property-read","property-write"],["deprecated","link","see","since"]]},"phpdoc_single_line_var_spacing":true,"phpdoc_summary":true,"phpdoc_tag_type":{"tags":{"inheritDoc":"inline"}},"phpdoc_trim":true,"phpdoc_trim_consecutive_blank_line_separation":true,"phpdoc_types":true,"phpdoc_types_order":{"null_adjustment":"always_last","sort_algorithm":"none"},"phpdoc_var_without_name":true,"semicolon_after_instruction":true,"simple_to_complex_string_variable":true,"single_class_element_per_statement":true,"single_import_per_statement":true,"single_line_comment_spacing":true,"single_line_comment_style":{"comment_types":["hash"]},"single_line_throw":true,"single_quote":true,"single_space_around_construct":true,"space_after_semicolon":{"remove_in_empty_for_expressions":true},"standardize_increment":true,"standardize_not_equals":true,"statement_indentation":{"stick_comment_to_next_continuous_control_statement":true},"switch_continue_to_break":true,"trailing_comma_in_multiline":true,"trim_array_spaces":true,"type_declaration_spaces":true,"types_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true,"array_indentation":true,"cast_spaces":true,"blank_line_after_opening_tag":true,"blank_lines_before_namespace":true,"compact_nullable_type_declaration":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_parentheses":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"return_type_declaration":true,"short_scalar_cast":true,"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_line_after_imports":true,"spaces_inside_parentheses":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"multiline_comment_opening_closing":true,"no_php4_constructor":true},"hashes":{"src\/Providers\/VerifyServiceProvider.php":"c6825d32544c6af8d699d00aebafc43a","src\/Commands\/VerifyCommand.php":"e20b4da0327e827bb92da380b382fe71","src\/Verify.php":"6a24bb3c24d7e63e35e804fcf1257f5d","src\/Facades\/VerifyFacade.php":"8843c3fcda2fd90d0f5a038437fd765e","database\/factories\/ModelFactory.php":"b91e8320557f3aeeb9c15cf96b38ca6b","config\/verify.php":"295af1204a7e9598efdd938a612e63b6","tests\/TestCase.php":"432e695df1baab54bef83616a9c70dae"}}
56 changes: 56 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

$finder = array_reduce(
[
__DIR__ . '/src/',
__DIR__ . '/database/',
__DIR__ . '/config/',
__DIR__ . '/resources/',
// __DIR__ . '/routes/',
__DIR__ . '/tests/',
],
function (PhpCsFixer\Finder $finder, $dir) {
return $finder->in($dir);
},
PhpCsFixer\Finder::create()->ignoreUnreadableDirs()
)->notName('*.blade.php');
$rules = [
'@Symfony' => true,
'nullable_type_declaration_for_default_null_value' => true,
'align_multiline_comment' => true,
'array_indentation' => true,
'fully_qualified_strict_types' => false,
'backtick_to_shell_exec' => true,
'increment_style' => ['style' => 'post'],
'indentation_type' => true,
'multiline_comment_opening_closing' => true,
'no_php4_constructor' => true,
'nullable_type_declaration' => false,
'phpdoc_no_empty_return' => false,
'single_blank_line_at_eof' => false,
'yoda_style' => false,
'concat_space' => ['spacing' => 'one'],
'no_superfluous_phpdoc_tags' => false,
'phpdoc_to_comment' => false, // required until https://github.com/phpstan/phpstan/issues/7486 got fixed
'blank_line_between_import_groups' => false, // not PSR-12 compatible, but preserves old behaviour
'ordered_imports' => [
'sort_algorithm' => 'alpha',
'imports_order' => null, // for PSR-12 compatability, this need to be `['class', 'function', 'const']`, but no grouping preserves old behaviour
],
'no_unneeded_control_parentheses' => [
'statements' => ['break', 'clone', 'continue', 'echo_print', 'switch_case', 'yield'],
],
'operator_linebreak' => [
'only_booleans' => true,
'position' => 'end',
],
];
$config = new PhpCsFixer\Config();

$config->setRiskyAllowed(true);
$config->setRules($rules);
$config->setIndent("\t");
$config->setLineEnding("\n");
$config->setFinder($finder);

return $config;
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changelog

All notable changes to `LycheeVerify` will be documented in this file.
32 changes: 32 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.PHONY: dist-gen dist-clean dist clean test formatting phpstan

composer:
rm -r vendor 2> /dev/null || true
composer install --prefer-dist --no-dev
php artisan vendor:publish --tag=log-viewer-asset

test:
@if [ -x "vendor/bin/phpunit" ]; then \
./vendor/bin/phpunit --stop-on-failure; \
else \
echo ""; \
echo "Please install phpunit:"; \
echo ""; \
echo " composer install"; \
echo ""; \
fi

formatting:
@rm .php_cs.cache 2> /dev/null || true
@if [ -x "vendor/bin/php-cs-fixer" ]; then \
PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix -v --config=.php-cs-fixer.php; \
else \
echo ""; \
echo "Please install php-cs-fixer:"; \
echo ""; \
echo " composer install"; \
echo ""; \
fi

phpstan:
vendor/bin/phpstan analyze
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,28 @@
# verify
# Lychee verification

## Testing

```bash
composer test
```

## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

## Security Vulnerabilities

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

## Credits

- [LycheeOrg](https://github.com/spatie)
- [All Contributors](../../contributors)

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
68 changes: 68 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"name": "lychee-org/lycheeverify",
"description": "Verification package for Lychee",
"homepage": "https://github.com/LycheeOrg/verify",
"license": "MIT",
"require": {
"php": "^8.2",
"illuminate/contracts": "^10.0||^11.0"
},
"require-dev": {
"nunomaduro/collision": "^8.3",
"larastan/larastan": "^2.9",
"orchestra/testbench": "^9.0.0||^8.22.0",
"friendsofphp/php-cs-fixer": "^3.3",
"lychee-org/phpstan-lychee": "^v1.0.1",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpunit/phpunit": "^10.0"
},
"autoload": {
"psr-4": {
"LycheeVerify\\": "src/",
"LycheeVerify\\Database\\Factories\\": "database/factories/"
}
},
"autoload-dev": {
"psr-4": {
"LycheeVerify\\Tests\\": "tests/",
"Workbench\\App\\": "workbench/app/"
}
},
"scripts": {
"post-autoload-dump": "@composer run prepare",
"clear": "@php vendor/bin/testbench package:purge-lycheeverify --ansi",
"prepare": "@php vendor/bin/testbench package:discover --ansi",
"build": [
"@composer run prepare",
"@php vendor/bin/testbench workbench:build --ansi"
],
"start": [
"Composer\\Config::disableProcessTimeout",
"@composer run build",
"@php vendor/bin/testbench serve"
],
"analyse": "vendor/bin/phpstan analyse",
"test": "vendor/bin/phpunit"
},
"config": {
"platform": {
"php": "8.2"
},
"sort-packages": true,
"allow-plugins": {
"phpstan/extension-installer": true
}
},
"extra": {
"laravel": {
"providers": [
"LycheeVerify\\VerifyServiceProvider"
],
"aliases": {
"LycheeVerify": "LycheeVerify\\Facades\\Verify"
}
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
15 changes: 15 additions & 0 deletions config/verify.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

return [
/*
|--------------------------------------------------------------------------
| ExampleName Configuration
|--------------------------------------------------------------------------
|
| This file contains various configuration options for the ExampleName package.
| You can modify these settings to customize the behavior of the package.
|
*/

'hashed_key' => env('LYCHEE_HASHED_KEY', ''),
];
19 changes: 19 additions & 0 deletions database/factories/ModelFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace LycheeVerify\Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;

/*
class ModelFactory extends Factory
{
protected $model = YourModel::class;
public function definition()
{
return [
];
}
}
*/
19 changes: 19 additions & 0 deletions database/migrations/create_lycheeverify_table.php.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up()
{
Schema::create('lycheeverify_table', function (Blueprint $table) {
$table->id();

// add fields

$table->timestamps();
});
}
};
Loading

0 comments on commit 8f507ce

Please sign in to comment.