Skip to content

Commit

Permalink
Merge pull request #10 from iamyukihiro/refactor-1
Browse files Browse the repository at this point in the history
refactor: PHP 8.3 & Architecture
  • Loading branch information
iamyukihiro authored Apr 28, 2024
2 parents 5622065 + 47342f3 commit 9be66b2
Show file tree
Hide file tree
Showing 46 changed files with 3,684 additions and 435 deletions.
35 changes: 0 additions & 35 deletions .circleci/config.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .config/psysh/config.php

This file was deleted.

12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2

updates:
- package-ecosystem: composer
directory: /
schedule:
interval: weekly

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
37 changes: 37 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: php

on:
- push

jobs:
build:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "name=dir::$(composer config cache-files-dir)" >> ${GITHUB_OUTPUT}
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir || '~/.cache/composer/files' }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest

- name: Check for Coding Standard
run: composer cs

- name: Check for Test
run: composer test
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/vendor/
/build/
/composer.lock
/phpunit.xml
/.phpunit.result.cache
/.idea
/.php-version
/.phpcs-cache
/.phpcs-cache
/.phpunit.cache/
Binary file modified .memory/tank.memory
Binary file not shown.
Binary file modified .memory/tank_test.memory
Binary file not shown.
15 changes: 0 additions & 15 deletions .scrutinizer.yml

This file was deleted.

41 changes: 27 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
# iamyukihiro/aquarium

PHPで水槽を再現してみる遊び用のアプリケーションです。
水槽にメダカを追加したり、水槽の中を見ることができます。
## Overview

## Enviroment
<img src="https://private-user-images.githubusercontent.com/42995313/326250292-a15d3a12-30aa-4796-9623-5565dbbde146.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTQzMDAyOTEsIm5iZiI6MTcxNDI5OTk5MSwicGF0aCI6Ii80Mjk5NTMxMy8zMjYyNTAyOTItYTE1ZDNhMTItMzBhYS00Nzk2LTk2MjMtNTU2NWRiYmRlMTQ2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA0MjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNDI4VDEwMjYzMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA2NWZjZGM5NDc5MzA2NjVhYzU1OGVhNDExODA4ZTY2MDFiNzQ3N2M3ZjlmMDI5YWY3MTc3ZWVkOWM1NjE2NjcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.nvxH8Tnctiwuqct49TZ-7stH8-NTIZg3g9WZvGuBY6E" width= "500px">

```
$ php -v
PHP 8.0.0 (cli) (built: Jan 28 2021 17:16:40) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v8.0.0, Copyright (c), by Zend Technologies
with Xdebug v3.0.2, Copyright (c) 2002-2021, by Derick Rethans
```
This is an application that simulates an aquarium using PHP.
You can add Medaka (killifish) to the aquarium and view inside the tank.

## Available Commands
## Requirement

以下のディレクトリにあります。
- Docker Engine
- Docker Compose

https://github.com/iamyukihiro/aquarium/tree/master/src/Service/PsySH
## Usage

### 1. Setup

Please, booting container.

`bin/compose`

### 2. Start aqua life

`bin/aquarium`

> [!NOTE]
> Playing water ASMR on YouTube is very effective.
#### Command list

- `init-tank`
- `view-tank`
- `add-medaka`
3 changes: 3 additions & 0 deletions bin/aquarium
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
cd bin/dev/ &&
docker compose exec -it aquarium sh -c "composer aquarium"
1 change: 1 addition & 0 deletions bin/dev/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
COMPOSE_PROJECT_NAME=aquarium
3 changes: 3 additions & 0 deletions bin/dev/compose
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
cd bin/dev/ &&
docker compose up -d
14 changes: 14 additions & 0 deletions bin/dev/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.9'

services:
aquarium:
container_name: aquarium
image: ghcr.io/iamyukihiro/php-base:8.3
volumes:
- type: bind
source: ../../
target: /var/www/html/
- type: bind
source: ../../bin/dev/php/conf.d/php.ini
target: /usr/local/etc/php/conf.d/php_override.ini
tty: true
3 changes: 3 additions & 0 deletions bin/dev/down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
cd bin/dev/ || exit
docker compose down -v
3 changes: 3 additions & 0 deletions bin/dev/in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
cd bin/dev/ &&
docker compose exec -it aquarium zsh
Empty file added bin/dev/php/conf.d/php.ini
Empty file.
14 changes: 0 additions & 14 deletions codecov.yml

This file was deleted.

61 changes: 20 additions & 41 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
{
"name": "goreboothero/aquarium",
"name": "iamyukihiro/aquarium",
"description": "",
"license": "MIT",
"authors": [
{
"name": "Yukihiro Arisawa",
"email": "goreboothero@gmail.com"
"email": "imyukihiro@gmail.com"
}
],
"require": {
"php": "8.0.*",
"psy/psysh": "^0.10.8",
"ext-http": "*"
"php": "8.3.*",
"psy/psysh": "^0.12",
"symfony/var-dumper": "^6.4"
},
"require-dev": {
"phpunit/phpunit": "^8.5",
"squizlabs/php_codesniffer": "^3.5",
"phpmd/phpmd": "^2.9",
"vimeo/psalm": "^4.1",
"phpmetrics/phpmetrics": "^2.7",
"doctrine/coding-standard": "^8.1",
"symfony/var-dumper": "^5.2"
"phpunit/phpunit": "^11.1",
"doctrine/coding-standard": "^12.0",
"phpspec/prophecy": "^1.19",
"phpspec/prophecy-phpunit": "^2.2"

},
"autoload": {
"psr-4": {
"Goreboothero\\Aquarium\\": "src/"
"Iamyukihiro\\Aquarium\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Goreboothero\\Aquarium\\": "tests/"
"Iamyukihiro\\Aquarium\\": "tests/"
}
},
"scripts": {
Expand All @@ -38,46 +36,27 @@
],
"tests": [
"@cs",
"@sa",
"@test"
],
"coverage": [
"php -dzend_extension=xdebug.so ./vendor/bin/phpunit --coverage-text --coverage-html=build/coverage"
],
"pcov": [
"php -dextension=pcov.so -d pcov.enabled=1 ./vendor/bin/phpunit --coverage-text --coverage-html=build/coverage --coverage-clover=coverage.xml"
],
"cs": [
"./vendor/bin/phpcs --standard=phpcs.xml src tests"
],
"cs-fix": [
"./vendor/bin/phpcbf src tests"
],
"sa": [
"psalm --show-info=true"
],
"metrics": [
"phpmetrics --report-html=build/metrics --excluded-dirs=src/Exception src"
],
"sh": [
"./vendor/bin/psysh --config ./.config/psysh/config.php"
],
"build": [
"@cs",
"@sa",
"@pcov",
"@metrics"
"aquarium": [
"./vendor/bin/psysh --config ./config/psysh/config.php"
]
},
"scripts-descriptions": {
"test": "Run unit tests",
"tests": "Run tests and quality checks",
"coverage": "Generate test coverage report",
"pcov": "Generate test coverage report (pcov)",
"cs": "Check the coding style",
"cs-fix": "Fix the coding style",
"sa": "Run static analysis",
"metrics": "Build metrics report",
"build": "Build project"
"cs-fix": "Fix the coding style"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
Loading

0 comments on commit 9be66b2

Please sign in to comment.