Skip to content

Commit

Permalink
feat: add version 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
medeirosinacio committed Apr 20, 2023
1 parent 8b48132 commit b56c1cd
Show file tree
Hide file tree
Showing 13 changed files with 213 additions and 12 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/formats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Formats

on: ['push', 'pull_request']

jobs:
ci:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.2]
dependency-version: [prefer-lowest, prefer-stable]

name: Formats P${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }}

steps:

- name: Checkout
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, mbstring, zip
tools: prestissimo
coverage: pcov

- name: Install Composer dependencies
run: composer update --${{ matrix.dependency-version }} --no-interaction --prefer-dist

- name: Coding Style Checks
run: composer test:lint

- name: Type Checks
run: composer test:types
39 changes: 39 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Tests

on: ['push', 'pull_request']

jobs:
ci:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
php: [8.2]
dependency-version: [prefer-lowest, prefer-stable]

name: Tests P${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }}

steps:

- name: Checkout
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

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

- name: Install Composer dependencies
run: composer update --${{ matrix.dependency-version }} --no-interaction --prefer-dist

- name: Integration Tests
run: php ./vendor/bin/pest
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Change Log

## 1.0.0 - 2020-04-03
## 2.0

Pacote atualizado a partir do repositório do Nuno Maduro [skeleton-php](https://github.com/nunomaduro/skeleton-php/blob/master/composer.json).

## 1.0

Copiados arquivos do repositorio original e feito as primeiras modificações para atender
a necessidade de uma estrutura basica de um projeto ou pacote PHP com docker.
45 changes: 37 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,60 @@
"name": "medeirosinacio/basic-php-project-structure",
"type": "standard",
"description": "Standard for PHP package skeletons.",
"keywords": [
"php",
"skeleton",
"package"
],
"homepage": "https://github.com/medeirosinacio/basic-php-project-structure",
"license": "MIT",
"authors": [
{
"name": "Douglas Medeiros",
"email": "[email protected]"
"email": "[email protected]"
}
],
"require": {
"php": ">=7.4"
"php": "^8.2.0"
},
"require-dev": {
"phpunit/phpunit": ">=9.0.2"
"laravel/pint": "^1.8",
"pestphp/pest": "^2.5.0",
"phpstan/phpstan": "^1.10.13",
"rector/rector": "^0.15.24",
"symfony/var-dumper": "^6.2.8"
},
"autoload": {
"psr-4": {
"medeirosinacio\\app\\": "src/"
"Medeirosinacio\\SkeletonPhp\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"medeirosinacio\\app\\": "tests/"
"Tests\\": "tests/"
}
},
"minimum-stability": "stable",
"prefer-stable": true,
"config": {
"sort-packages": true,
"preferred-install": "dist",
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"bin": [
"bin/medeirosinacio-app"
]
"scripts": {
"refacto": "rector",
"lint": "pint",
"test:refacto": "rector --dry-run",
"test:lint": "pint --test",
"test:types": "phpstan analyse --ansi",
"test:unit": "pest --colors=always",
"test": [
"@test:refacto",
"@test:lint",
"@test:types",
"@test:unit"
]
}
}
6 changes: 6 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
level: max
paths:
- src

reportUnmatchedIgnoredErrors: true
16 changes: 16 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
colors="true"
cacheDirectory=".phpunit.cache">
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
<testsuites>
<testsuite name="default">
<directory suffix=".php">./tests</directory>
</testsuite>
</testsuites>
</phpunit>
8 changes: 8 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"rules": {
"not_operator_with_successor_space": false,
"@PSR1": true,
"@PSR2": true,
"@PSR12:risky": true
}
}
4 changes: 2 additions & 2 deletions public/index.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

(@include_once("../vendor/autoload.php")) or die("waiting for command composer install...");
(@include_once('../vendor/autoload.php')) or exit('waiting for command composer install...');

echo 'Hello, World!!!';
echo 'Hello, World!!!';
3 changes: 2 additions & 1 deletion public/phpinfo.php
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<?php
phpinfo();

phpinfo();
27 changes: 27 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__.'/src',
]);

$rectorConfig->rules([
InlineConstructorDefaultToPropertyRector::class,
]);

$rectorConfig->sets([
LevelSetList::UP_TO_PHP_82,
SetList::CODE_QUALITY,
SetList::DEAD_CODE,
SetList::EARLY_RETURN,
SetList::TYPE_DECLARATION,
SetList::PRIVATIZATION,
]);
};
Empty file removed src/.gitkeep
Empty file.
16 changes: 16 additions & 0 deletions src/Example.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

namespace Medeirosinacio\SkeletonPhp;

/**
* @internal
*/
final class Example
{
public function foo(): string
{
return 'bar';
}
}
11 changes: 11 additions & 0 deletions tests/Feature.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

use Medeirosinacio\SkeletonPhp\Example;

it('foo', function () {
$example = new Example();

$result = $example->foo();

expect($result)->toBe('bar');
});

0 comments on commit b56c1cd

Please sign in to comment.