Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
CONTAINER ?= php83
DOCKER_RUN=docker compose run --rm $(CONTAINER)

setup:
docker compose build $(CONTAINER)
$(DOCKER_RUN) composer update

tests:
docker compose run --rm $(CONTAINER) bin/php-cs-fixer fix --verbose --diff --dry-run
docker compose run --rm $(CONTAINER) bin/phpspec run --format=pretty
docker compose run --rm $(CONTAINER) bin/behat --snippets-for

matrix-tests:
CONTAINER=php81 $(MAKE) setup
CONTAINER=php81 $(MAKE) tests

CONTAINER=php82 $(MAKE) setup
CONTAINER=php82 $(MAKE) tests

CONTAINER=php83 $(MAKE) setup
CONTAINER=php83 $(MAKE) tests

doc-images:
docker compose run --rm php83 rm -f doc/flat.svg doc/flat-square.svg doc/plastic.svg doc/for-the-badge.svg

docker compose run --rm php83 bin/poser poser FLAT blue -s "flat" -p "doc/flat.svg"
docker compose run --rm php83 bin/poser poser "FLAT SQUARE" blue -s "flat-square" -p "doc/flat-square.svg"
docker compose run --rm php83 bin/poser poser PLASTIC blue -s "plastic" -p "doc/plastic.svg"
docker compose run --rm php83 bin/poser poser "FOR THE BADGE" blue -s "for-the-badge" -p "doc/for-the-badge.svg"
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ Choose a different style
poser license MIT blue -s "for-the-badge"
```

You can also use the provided Docker Compose services:

```bash
docker compose run --rm php82 bin/poser license MIT blue
docker compose run --rm php83 bin/poser license MIT blue -p "license.svg"
docker compose run --rm php83 bin/poser license MIT blue -s "plastic" -p "license-plastic.svg"
```


## Usage as library

#### 1. Add to composer dependencies
Expand Down Expand Up @@ -72,6 +81,16 @@ echo $image->getStyle();

The allowed styles are: `plastic`, `flat`, `flat-square`, and `for-the-badge`.

### Examples (generated with `make doc-images`)

![Flat style](doc/flat.svg)

![Flat square style](doc/flat-square.svg)

![Plastic style](doc/plastic.svg)

![For the badge style](doc/for-the-badge.svg)


## Encoding

Expand Down Expand Up @@ -99,6 +118,30 @@ Active contribution and patches are very welcome.
Please refer to [CONTRIBUTING](CONTRIBUTING.md)


## Docker development

You can use the env var CONTAINER to run the tests in a specific PHP version.
The default version if CONTAINER is omitted is php83.

#### 1. Setup your Docker environment

```bash
CONTAINER=php83 make setup
```

#### 2. Run the tests

```bash
CONTAINER=php83 make tests
```

#### 3. Run the tests for all PHP versions

```bash
make matrix-tests
```


## License

[![License](https://poser.pugx.org/badges/poser/license.svg)](./LICENSE)
28 changes: 12 additions & 16 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
x-php-service: &php-service
working_dir: /application
stdin_open: true
volumes:
- .:/application:cached
environment:
- COMPOSER_HOME=/tmp/.composer

services:
php81:
<<: *php-service
build:
context: .docker/php81
working_dir: /application
stdin_open: true
volumes:
- .:/application:cached

php82:
<<: *php-service
build:
context: .docker/php82
working_dir: /application
stdin_open: true
volumes:
- .:/application:cached

php83:
<<: *php-service
build:
context: .docker/php83
working_dir: /application
stdin_open: true
volumes:
- .:/application:cached

php84:
<<: *php-service
build:
context: .docker/php84
working_dir: /application
stdin_open: true
volumes:
- .:/application:cached
11 changes: 0 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,6 @@
}
},
"bin": ["bin/poser"],
"scripts": {
"php-cs-fixer-dry-run": "bin/php-cs-fixer fix --verbose --diff --dry-run --ansi",
"php-cs-fixer": "bin/php-cs-fixer fix -v --ansi",
"behat": "bin/behat --snippets-for",
"docker:build:php81": "docker build -t pugx/poser:php81 -f .docker/base/php81/Dockerfile .",
"docker:push:php81": "docker push pugx/poser:php81",
"docker:build:php82": "docker build -t pugx/poser:php82 -f .docker/base/php82/Dockerfile .",
"docker:push:php82": "docker push pugx/poser:php82",
"docker:build:php83": "docker build -t pugx/poser:php83 -f .docker/base/php83/Dockerfile .",
"docker:push:php83": "docker push pugx/poser:php83"
},
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
Expand Down
20 changes: 20 additions & 0 deletions doc/flat-square.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions doc/flat.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions doc/for-the-badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions doc/plastic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.