-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 46617f5
Showing
13 changed files
with
571 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# laravel default | ||
*.css linguist-vendored | ||
*.less linguist-vendored | ||
|
||
# These settings are for any web project | ||
|
||
# Handle line endings automatically for files detected as text | ||
# and leave all files detected as binary untouched. | ||
* text=auto | ||
|
||
# | ||
# The above will handle all files NOT found below | ||
# | ||
|
||
# | ||
## These files are text and should be normalized (Convert crlf => lf) | ||
# | ||
|
||
# source code | ||
*.php text | ||
*.css text | ||
*.sass text | ||
*.scss text | ||
*.less text | ||
*.styl text | ||
*.js text | ||
*.coffee text | ||
*.json text | ||
*.htm text | ||
*.html text | ||
*.xml text | ||
*.svg text | ||
*.txt text | ||
*.ini text | ||
*.inc text | ||
*.pl text | ||
*.rb text | ||
*.py text | ||
*.scm text | ||
*.sql text | ||
*.sh text | ||
*.bat text | ||
|
||
# templates | ||
*.ejs text | ||
*.hbt text | ||
*.jade text | ||
*.haml text | ||
*.hbs text | ||
*.dot text | ||
*.tmpl text | ||
*.phtml text | ||
|
||
# server config | ||
.htaccess text | ||
|
||
# git config | ||
.gitattributes text | ||
.gitignore text | ||
|
||
# code analysis config | ||
.jshintrc text | ||
.jscsrc text | ||
.jshintignore text | ||
.csslintrc text | ||
|
||
# misc config | ||
*.yaml text | ||
*.yml text | ||
.editorconfig text | ||
|
||
# build config | ||
*.npmignore text | ||
*.bowerrc text | ||
|
||
# Heroku | ||
Procfile text | ||
.slugignore text | ||
|
||
# Documentation | ||
*.md text | ||
LICENSE text | ||
AUTHORS text | ||
|
||
# | ||
## These files are binary and should be left untouched | ||
# | ||
|
||
# (binary is a macro for -text -diff) | ||
*.png binary | ||
*.jpg binary | ||
*.jpeg binary | ||
*.gif binary | ||
*.ico binary | ||
*.mov binary | ||
*.mp4 binary | ||
*.mp3 binary | ||
*.flv binary | ||
*.fla binary | ||
*.swf binary | ||
*.gz binary | ||
*.zip binary | ||
*.7z binary | ||
*.ttf binary | ||
*.eot binary | ||
*.woff binary | ||
*.pyc binary | ||
*.pdf binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: CI | ||
on: [pull_request] | ||
jobs: | ||
tests: | ||
name: Laravel Dt0 (PHP ${{ matrix.php-versions }}) | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php-versions: [ '8.1', '8.2' ] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: mbstring, dom, fileinfo, gmp, bcmath | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Cache composer dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Remove composer.lock | ||
run: rm -f composer.lock | ||
|
||
- name: Install Composer dependencies | ||
run: composer install --no-progress --prefer-dist --optimize-autoloader | ||
|
||
- name: Test with phpunit | ||
run: vendor/bin/phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: QA | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [ opened, synchronize ] | ||
jobs: | ||
tests: | ||
name: Laravel Dt0 QA | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.1 | ||
extensions: mbstring, dom, fileinfo, gmp, bcmath | ||
coverage: xdebug | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Cache composer dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Remove composer.lock | ||
run: rm -f composer.lock | ||
|
||
- name: Install Composer dependencies | ||
run: composer install --no-progress --prefer-dist --optimize-autoloader | ||
|
||
- name: Check code style | ||
run: vendor/bin/pint --config pint.json | ||
|
||
- name: Compute Coverage | ||
run: vendor/bin/phpunit --coverage-clover ./coverage.xml | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: ./coverage.xml | ||
flags: unittests | ||
name: codecov-Dt0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/vendor | ||
.*.cache | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 fab2s | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Laravel Dt0 | ||
|
||
[![CI](https://github.com/fab2s/laravel-dt0/actions/workflows/ci.yml/badge.svg)](https://github.com/fab2s/laravel-dt0/actions/workflows/ci.yml) [![CI](https://github.com/fab2s/laravel-dt0/actions/workflows/ci.yml/badge.svg)](https://github.com/fab2s/laravel-dt0/actions/workflows/ci.yml) | ||
|
||
Laravel support for [Dt0](https://github.com/fab2s/dt0), a DTO (_Data-Transport-Object_) PHP implementation than can both secure mutability and implement convenient ways to take control over input and output in various format. | ||
|
||
## Installation | ||
|
||
`Dt0` can be installed using composer: | ||
|
||
```shell | ||
composer require "fab2s/dt0" | ||
``` | ||
|
||
Once done, you can start playing : | ||
|
||
```php | ||
|
||
// either get a Dt0 instance or a ValidationException | ||
$dt0 = SomeValidatableDt0::withValidation(...\Illuminate\Http\Request::all()); | ||
``` | ||
|
||
## Requirements | ||
|
||
`Dt0` is tested against php 8.1 and 8.2 | ||
|
||
## Contributing | ||
|
||
Contributions are welcome, do not hesitate to open issues and submit pull requests. | ||
|
||
## License | ||
|
||
`Dt0` is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
"name": "fab2s/laravel-dt0", | ||
"description": "Laravel support for fab2s/dt0", | ||
"type": "library", | ||
"authors": [{ | ||
"name": "Fabrice de Stefanis" | ||
}], | ||
"homepage": "https://github.com/fab2s/laravel-dt0", | ||
"support": { | ||
"issues": "https://github.com/fab2s/laravel-dt0/issues", | ||
"source": "https://github.com/fab2s/laravel-dt0" | ||
}, | ||
"keywords": [ | ||
"Laravel", | ||
"Data-Transport-Object", | ||
"DTO", | ||
"DT0", | ||
"symfony", | ||
"laravel", | ||
"PHP", | ||
"Serializable", | ||
"immutable", | ||
"readonly", | ||
"JSON", | ||
"Data-Processing" | ||
], | ||
"license": [ | ||
"MIT" | ||
], | ||
"require": { | ||
"php": "^8.1", | ||
"fab2s/dt0": "*", | ||
"illuminate/translation": "^10.0|^11.0", | ||
"illuminate/validation": "^10.0|^11.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^10.0", | ||
"laravel/pint": "^1.10", | ||
"orchestra/testbench": "^8.0|^9.0" | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"autoload": { | ||
"psr-4": { | ||
"fab2s\\Dt0\\Laravel\\": "src" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"fab2s\\Dt0\\Laravel\\Tests\\": "tests" | ||
} | ||
}, | ||
"scripts": { | ||
"post-update-cmd": [ | ||
"rm -rf .*.cache" | ||
], | ||
"post-install-cmd": [ | ||
"rm -rf .*.cache" | ||
], | ||
"fix": "@php vendor/bin/pint --config pint.json" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false"> | ||
<coverage/> | ||
<testsuites> | ||
<testsuite name="CI"> | ||
<directory suffix="Test.php">./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<php> | ||
<env name="APP_KEY" value="base64:2fl+Ktvkfl+Fuz4Qp/A75G2RTiWVA/ZoKZvp6fiiM10="/> | ||
</php> | ||
<source> | ||
<include> | ||
<directory suffix=".php">src/</directory> | ||
</include> | ||
</source> | ||
</phpunit> |
Oops, something went wrong.