Skip to content

Commit

Permalink
Initialize project with jeromegamez/cookiecutter-php
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegamez committed Dec 3, 2023
0 parents commit 3704432
Show file tree
Hide file tree
Showing 16 changed files with 412 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

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

[*.md]
trim_trailing_whitespace = false

[**.{neon,neon.dist}]
indent_style = tab

[**.{yml,yaml}]
indent_size = 2
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.php diff=php

/.build export-ignore
/.github export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php-cs-fixer.dist.php export-ignore
/phpstan.neon.dist export-ignore
/phpunit.dist.xml export-ignore
46 changes: 46 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2

updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"

- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"
14 changes: 14 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# https://probot.github.io/apps/settings/

repository:
allow_squash_merge: true
allow_merge_commit: false
allow_rebase_merge: true
default_branch: main
delete_branch_on_merge: true
enable_automated_security_fixes: true
enable_vulnerability_alerts: true
has_downloads: false
has_projects: true
has_wiki: false
use_squash_pr_title_as_default: true
79 changes: 79 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Tests

on:
pull_request:
paths:
- '.github/workflows/tests.yml'
- 'src/**'
- 'tests/**'
- 'composer.json'
- 'phpstan.neon.dist'
push:
branches: ['main']
paths:
- '.github/workflows/tests.yml'
- 'src/**'
- 'tests/**'
- 'composer.json'
- 'phpstan.neon.dist'
workflow_dispatch:

jobs:
test:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php:
- "8.2"
- "8.3"

env:
extensions: ctype, dom, intl, json, mbstring, openssl, xml, zip, zlib
key: cache-v1 # can be any string, change to clear the extension cache.

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

- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}

- name: Cache extensions
uses: actions/cache@v3
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.extensions }}
tools: composer, pecl
coverage: xdebug
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: ramsey/composer-install@v2
with:
composer-options: "${{ matrix.composer-options }}"

- name: Setup Problem Matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Run PHPStan
run: vendor/bin/phpstan

- name: Run PHPUnit
run: vendor/bin/phpunit --testdox --coverage-text
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/.build
/tools
/vendor

/.php-cs-fixer.cache
/.phpunit.result.cache
/.phpunit.xml

/composer.lock
/phpstan.neon
/phpunit.xml
21 changes: 21 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

$finder = PhpCsFixer\Finder::create()->in(__DIR__);

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PER-CS2.0' => true,
'no_unused_imports' => true,
'ordered_imports' => [
'imports_order' => [
'class',
'function',
'const',
],
'sort_algorithm' => 'alpha',
],
])
->setFinder($finder);
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# CHANGELOG

## [Unreleased]

<!--
[Unreleased]: https://github.com/beste/array-cache/compare/1.0.0...main
[1.0.0]: https://github.com/beste/array-cache/tree/1.0.0
-->
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) Jérôme Gamez, https://github.com/beste <[email protected]>

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.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# PSR-6 Array Cache

A PSR-6 Array Cache

<!--
[![Current version](https://img.shields.io/packagist/v/beste/array-cache.svg?logo=composer)](https://packagist.org/packages/beste/array-cache)
[![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/beste/array-cache)](https://packagist.org/packages/beste/array-cache)
[![Monthly Downloads](https://img.shields.io/packagist/dm/beste/array-cache.svg)](https://packagist.org/packages/beste/array-cache/stats)
[![Total Downloads](https://img.shields.io/packagist/dt/beste/array-cache.svg)](https://packagist.org/packages/beste/array-cache/stats)
[![Tests](https://github.com/beste/array-cache/actions/workflows/tests.yml/badge.svg)](https://github.com/beste/array-cache/actions/workflows/tests.yml)
-->

## Installation

```shell
composer require beste/array-cache
```

## Running tests

```shell
composer test
```

## License

This project is published under the [MIT License](LICENSE).
56 changes: 56 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "beste/array-cache",
"description": "A PSR-6 Array Cache",
"license": "ISC",
"type": "library",
"authors": [
{
"name": "Jérôme Gamez",
"email": "[email protected]"
}
],
"require": {
"php": "~8.2.0 || ~8.3.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.40.2",
"phpstan/extension-installer": "^1.3.1",
"phpstan/phpstan": "^1.10.47",
"phpstan/phpstan-deprecation-rules": "^1.1.4",
"phpstan/phpstan-phpunit": "^1.3.15",
"phpstan/phpstan-strict-rules": "^1.5.2",
"phpunit/phpunit": "^10.5.1",
"symfony/var-dumper": "^6.4.0"
},
"autoload": {
"psr-4": {
"Beste\\Psr\\Cache\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Beste\\Psr\\Cache\\Tests\\": "tests"
}
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true
},
"sort-packages": true
},
"scripts": {
"analyse": "vendor/bin/phpstan analyse",
"analyze": "@analyse",
"cs-fix": "vendor/bin/php-cs-fixer fix --diff --verbose",
"test": "vendor/bin/phpunit --testdox",
"test-coverage": [
"Composer\\Config::disableProcessTimeout",
"XDEBUG_MODE=coverage vendor/bin/phpunit --testdox --coverage-html=.build/coverage"
],
"check": [
"@cs-fix",
"@analyse",
"@test"
]
}
}
9 changes: 9 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
parameters:
level: max

paths:
- src/
- tests/

includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
19 changes: 19 additions & 0 deletions phpunit.dist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheResultFile=".build/.phpunit.result.cache"
colors="true"
>
<testsuites>
<testsuite name="Tests">
<directory>tests</directory>
</testsuite>
</testsuites>

<source>
<include>
<directory>src</directory>
</include>
</source>
</phpunit>
20 changes: 20 additions & 0 deletions src/Placeholder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace Beste\Psr\Cache;

final class Placeholder
{
private string $prefix;

public function __construct(string $prefix)
{
$this->prefix = $prefix;
}

public function echo(string $value): string
{
return $this->prefix.$value;
}
}
Loading

0 comments on commit 3704432

Please sign in to comment.