mirror of
https://github.com/ambieco/laravel-lift.git
synced 2026-01-12 19:14:03 +08:00
Initial structure
This commit is contained in:
15
.editorconfig
Normal file
15
.editorconfig
Normal file
@@ -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,json}]
|
||||
indent_size = 2
|
||||
9
.gitattributes
vendored
Normal file
9
.gitattributes
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/.github 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
.github/FUNDING.yml
vendored
Normal file
4
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [WendellAdriel]
|
||||
custom: ["https://www.paypal.me/wendelladriel"]
|
||||
36
.github/workflows/tests.yml
vendored
Normal file
36
.github/workflows/tests.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: run-tests
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
php: [8.2, 8.1]
|
||||
dependency-version: [prefer-lowest, prefer-stable]
|
||||
|
||||
name: PHP ${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
coverage: none
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
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
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
.DS_Store
|
||||
/vendor
|
||||
/.idea
|
||||
/.vagrant
|
||||
/.phpstorm.*
|
||||
composer.lock
|
||||
.phpunit.result.cache
|
||||
44
CONTRIBUTING.md
Normal file
44
CONTRIBUTING.md
Normal file
@@ -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
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 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.
|
||||
31
README.md
Normal file
31
README.md
Normal file
@@ -0,0 +1,31 @@
|
||||
<div align="center">
|
||||
<p>
|
||||
<h1>🏋️ Lift for Laravel</h1>
|
||||
Take your Eloquent Models to the next level
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://packagist.org/packages/WendellAdriel/laravel-lift"><img src="https://img.shields.io/packagist/v/WendellAdriel/laravel-lift.svg?style=flat-square" alt="Packagist"></a>
|
||||
<a href="https://packagist.org/packages/WendellAdriel/laravel-lift"><img src="https://img.shields.io/packagist/php-v/WendellAdriel/laravel-lift.svg?style=flat-square" alt="PHP from Packagist"></a>
|
||||
<a href="https://github.com/WendellAdriel/laravel-lift/actions"><img alt="GitHub Workflow Status (main)" src="https://img.shields.io/github/actions/workflow/status/WendellAdriel/laravel-lift/tests.yml?branch=main&label=Tests"> </a>
|
||||
</p>
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
composer require wendelladriel/laravel-lift
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
TBD
|
||||
|
||||
## Credits
|
||||
|
||||
- [Wendell Adriel](https://github.com/WendellAdriel)
|
||||
- [All Contributors](../../contributors)
|
||||
|
||||
## Contributing
|
||||
|
||||
Check the **[Contributing Guide](CONTRIBUTING.md)**.
|
||||
60
composer.json
Normal file
60
composer.json
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "wendelladriel/laravel-lift",
|
||||
"description": "Take your Eloquent Models to the next level",
|
||||
"type": "library",
|
||||
"keywords": [
|
||||
"laravel",
|
||||
"eloquent",
|
||||
"model",
|
||||
"attributes",
|
||||
"casts",
|
||||
"validation"
|
||||
],
|
||||
"license": "MIT",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"WendellAdriel\\Lift\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"WendellAdriel\\Lift\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"support": {
|
||||
"issues": "https://github.com/WendellAdriel/laravel-lift/issues",
|
||||
"source": "https://github.com/WendellAdriel/laravel-lift"
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Wendell Adriel",
|
||||
"email": "wendelladriel.ti@gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^8.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"pestphp/pest": "^2.15",
|
||||
"laravel/pint": "^1.11",
|
||||
"phpstan/phpstan": "^1.10"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "pint",
|
||||
"test:lint": "pint --test",
|
||||
"test:unit": "./vendor/bin/pest --order-by random",
|
||||
"test:static": "phpstan analyse",
|
||||
"test": [
|
||||
"@test:lint",
|
||||
"@test:unit",
|
||||
"@test:static"
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"pestphp/pest-plugin": true
|
||||
}
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true
|
||||
}
|
||||
6
phpstan.neon
Normal file
6
phpstan.neon
Normal file
@@ -0,0 +1,6 @@
|
||||
parameters:
|
||||
|
||||
paths:
|
||||
- src/
|
||||
|
||||
level: 9
|
||||
18
phpunit.xml
Normal file
18
phpunit.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?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"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Test Suite">
|
||||
<directory suffix="Test.php">./tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<coverage>
|
||||
<include>
|
||||
<directory suffix=".php">./app</directory>
|
||||
<directory suffix=".php">./src</directory>
|
||||
</include>
|
||||
</coverage>
|
||||
</phpunit>
|
||||
56
pint.json
Normal file
56
pint.json
Normal file
@@ -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
|
||||
}
|
||||
}
|
||||
11
src/Lift.php
Normal file
11
src/Lift.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace WendellAdriel\Lift;
|
||||
|
||||
trait Lift
|
||||
{
|
||||
public static function bootLift(): void
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
45
tests/Pest.php
Normal file
45
tests/Pest.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Test Case
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The closure you provide to your test functions is always bound to a specific PHPUnit test
|
||||
| case class. By default, that class is "PHPUnit\Framework\TestCase". Of course, you may
|
||||
| need to change it using the "uses()" function to bind a different classes or traits.
|
||||
|
|
||||
*/
|
||||
|
||||
// uses(Tests\TestCase::class)->in('Feature');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Expectations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When you're writing tests, you often need to check that values meet certain conditions. The
|
||||
| "expect()" function gives you access to a set of "expectations" methods that you can use
|
||||
| to assert different things. Of course, you may extend the Expectation API at any time.
|
||||
|
|
||||
*/
|
||||
|
||||
expect()->extend('toBeOne', fn () => $this->toBe(1));
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Functions
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| While Pest is very powerful out-of-the-box, you may have some testing code specific to your
|
||||
| project that you don't want to repeat in every file. Here you can also expose helpers as
|
||||
| global functions to help you to reduce the number of lines of code in your test files.
|
||||
|
|
||||
*/
|
||||
|
||||
function something()
|
||||
{
|
||||
// ..
|
||||
}
|
||||
12
tests/TestCase.php
Normal file
12
tests/TestCase.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase as BaseTestCase;
|
||||
|
||||
abstract class TestCase extends BaseTestCase
|
||||
{
|
||||
//
|
||||
}
|
||||
Reference in New Issue
Block a user