Skip to content

Commit

Permalink
Initial structure
Browse files Browse the repository at this point in the history
  • Loading branch information
WendellAdriel committed May 6, 2024
0 parents commit f983ad8
Show file tree
Hide file tree
Showing 14 changed files with 399 additions and 0 deletions.
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
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/.github export-ignore
/art export-ignore
/tests export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
CONTRIBUTING.md export-ignore
phpstan.neon export-ignore
phpunit.xml export-ignore
pint.json export-ignore
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

github: [WendellAdriel]
custom: ["https://www.paypal.me/wendelladriel"]
42 changes: 42 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: run-tests

on: [push, pull_request]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
php: [8.3, 8.2]
laravel: [11.*]
dependency-version: [prefer-stable]
include:
- laravel: 11.*
testbench: 9.*

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.dependency-version }}

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:>=2.62.1" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Code Style 👨‍🏭
run: composer test:lint

- name: Pest Tests 🧫
run: composer test:unit

- name: PHPStan 🧪
run: composer test:static
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.DS_Store
/vendor
/.idea
/.vagrant
/.phpstorm.*
composer.lock
.phpunit.result.cache
44 changes: 44 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# CONTRIBUTING

Contributions are welcome, and are accepted via pull requests.
Please review these guidelines before submitting any pull requests.

For major changes, please open an issue first describing what you want to add/change.

## Process

1. Fork the project
2. Create a new branch
3. Code, test, commit and push
4. Open a pull request detailing your changes

## Guidelines

* Please ensure the coding style running `composer lint`.
* Send a coherent commit history, making sure each individual commit in your pull request is meaningful.
* You may need to [rebase](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) to avoid merge conflicts.
* Please remember that we follow [SemVer](http://semver.org/).

## Setup

Clone your fork, then install the dev dependencies:
```bash
composer install
```
## Lint

Lint your code:
```bash
composer lint
```
## Tests

Run all tests:
```bash
composer test
```

Unit tests:
```bash
composer test:unit
```
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Wendell Adriel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<div align="center">
<!-- <img src="https://github.com/WendellAdriel/laravel-virtue/raw/main/art/laravel-virtue-banner.png" alt="Virtue for Laravel" height="400"/> -->
<p>
<h1>Virtue for Laravel</h1>
Extend the Laravel Framework with a collection of attributes
</p>
</div>

<p align="center">
<a href="https://packagist.org/packages/WendellAdriel/laravel-virtue"><img src="https://img.shields.io/packagist/v/WendellAdriel/laravel-virtue.svg?style=flat-square" alt="Packagist"></a>
<a href="https://packagist.org/packages/WendellAdriel/laravel-virtue"><img src="https://img.shields.io/packagist/php-v/WendellAdriel/laravel-virtue.svg?style=flat-square" alt="PHP from Packagist"></a>
<a href="https://packagist.org/packages/WendellAdriel/laravel-virtue"><img src="https://img.shields.io/badge/Laravel-11.x-brightgreen.svg?style=flat-square" alt="Laravel Version"></a>
<a href="https://github.com/WendellAdriel/laravel-virtue/actions"><img alt="GitHub Workflow Status (main)" src="https://img.shields.io/github/actions/workflow/status/WendellAdriel/laravel-virtue/tests.yml?branch=main&label=Tests"> </a>
</p>

**Virtue** is a package that extends the Laravel Framework by providing a collection of attributes that you can use to
configure and extend the built-in classes of the framework.

The focus of the package is to bring the power of the PHP 8 attributes to improve the DX on how to configure and extend
your Laravel applications.

## Documentation
[![Docs Button]][Docs Link] [![DocsRepo Button]][DocsRepo Link]

## Installation

```bash
composer require wendelladriel/laravel-virtue
```

## Credits

- [Wendell Adriel](https://github.com/WendellAdriel)
- [All Contributors](../../contributors)

## Contributing

Check the **[Contributing Guide](CONTRIBUTING.md)**.

<!---------------------------------------------------------------------------->
[Docs Button]: https://img.shields.io/badge/Website-B30E2E?style=for-the-badge&logoColor=white&logo=GitBook
[Docs Link]: https://wendell-adriel.gitbook.io/laravel-virtue/
[DocsRepo Button]: https://img.shields.io/badge/Repository-3884FF?style=for-the-badge&logoColor=white&logo=GitBook
[DocsRepo Link]: https://github.com/WendellAdriel/laravel-virtue-docs
70 changes: 70 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"name": "wendelladriel/laravel-virtue",
"description": "Extend the Laravel Framework with a collection of attributes",
"type": "library",
"keywords": [
"laravel",
"attributes",
"extend",
"configuration"
],
"license": "MIT",
"autoload": {
"psr-4": {
"WendellAdriel\\Virtue\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"support": {
"issues": "https://github.com/WendellAdriel/laravel-virtue/issues",
"source": "https://github.com/WendellAdriel/laravel-virtue"
},
"authors": [
{
"name": "Wendell Adriel",
"email": "wendelladriel.ti@gmail.com"
}
],
"require": {
"php": "^8.2",
"illuminate/database": "^11.0",
"illuminate/support": "^11.0"
},
"require-dev": {
"larastan/larastan": "^2.0",
"laravel/pint": "^1.14",
"orchestra/testbench": "^8.0|^9.0",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-faker": "^2.0",
"phpstan/phpstan": "^1.10"
},
"scripts": {
"lint": "pint",
"test:lint": "pint --test",
"test:unit": "./vendor/bin/pest --order-by random",
"test:static": "phpstan analyse --memory-limit 1G",
"test": [
"@test:lint",
"@test:unit",
"@test:static"
]
},
"extra": {
"laravel": {
"providers": [
"WendellAdriel\\Virtue\\Providers\\VirtueServiceProvider"
]
}
},
"config": {
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}
6 changes: 6 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:

paths:
- src/

level: 9
18 changes: 18 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<coverage/>
<php>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
</php>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
56 changes: 56 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"preset": "laravel",
"rules": {
"array_push": true,
"assign_null_coalescing_to_coalesce_equal": true,
"combine_consecutive_issets": true,
"combine_consecutive_unsets": true,
"concat_space": {
"spacing": "one"
},
"declare_strict_types": true,
"explicit_indirect_variable": true,
"explicit_string_variable": true,
"global_namespace_import": true,
"method_argument_space": {
"on_multiline": "ensure_fully_multiline"
},
"modernize_strpos": true,
"modernize_types_casting": true,
"new_with_braces": true,
"no_superfluous_elseif": true,
"no_useless_else": true,
"nullable_type_declaration_for_default_null_value": true,
"ordered_imports": {
"sort_algorithm": "alpha"
},
"ordered_class_elements": {
"order": [
"use_trait",
"case",
"constant",
"constant_public",
"constant_protected",
"constant_private",
"property_public",
"property_protected",
"property_private",
"construct",
"destruct",
"magic",
"phpunit",
"method_abstract",
"method_public_static",
"method_public",
"method_protected_static",
"method_protected",
"method_private_static",
"method_private"
],
"sort_algorithm": "none"
},
"strict_comparison": true,
"ternary_to_null_coalescing": true,
"use_arrow_functions": true
}
}
15 changes: 15 additions & 0 deletions src/Providers/VirtueServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

namespace WendellAdriel\Virtue\Providers;

use Illuminate\Support\ServiceProvider;

final class VirtueServiceProvider extends ServiceProvider
{
public function boot(): void
{
//
}
}
Loading

0 comments on commit f983ad8

Please sign in to comment.