Skip to content

Commit 12d50d7

Browse files
committed
✨ First version
1 parent 44e2585 commit 12d50d7

File tree

12 files changed

+506
-0
lines changed

12 files changed

+506
-0
lines changed

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/.gitattributes export-ignore
2+
/.github export-ignore
3+
/.docker-compose.yml export-ignore
4+
/Dockerfile export-ignore
5+
/phpunit.xml export-ignore
6+
/tests export-ignore
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#name: Packagist Deploy
2+
#
3+
#on:
4+
# release:
5+
# types: [created]
6+
#
7+
#jobs:
8+
# build:
9+
#
10+
# runs-on: ubuntu-latest
11+
# permissions:
12+
# contents: read
13+
# packages: write
14+
#
15+
# steps:
16+
# - uses: actions/checkout@v4
17+
# - uses: mnavarrocarter/packagist-update@v1.0.0
18+
# with:
19+
# username: "GautierDele"
20+
# api_token: ${{ secrets.PACKAGIST_TOKEN }}

.github/workflows/tests.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
php-version: [ '8.3', '8.4', '8.5' ]
18+
19+
name: Tests on PHP ${{ matrix.php-version }}
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: ${{ matrix.php-version }}
29+
coverage: none
30+
31+
- name: Validate composer.json and composer.lock
32+
run: composer validate
33+
34+
- name: Cache Composer packages
35+
id: composer-cache
36+
uses: actions/cache@v4
37+
with:
38+
path: vendor
39+
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
40+
restore-keys: |
41+
${{ runner.os }}-php-${{ matrix.php-version }}-
42+
43+
- name: Install dependencies
44+
if: steps.composer-cache.outputs.cache-hit != 'true'
45+
run: composer i --prefer-dist --no-progress
46+
47+
- name: Run test suite
48+
run: vendor/bin/phpunit

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/vendor
2+
composer.lock
3+
.phpunit*
4+
.idea

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM php:latest
2+
3+
RUN apt update
4+
RUN apt install unzip curl -y
5+
6+
RUN curl -sS https://getcomposer.org/installer -o /usr/local/composer-setup.php
7+
8+
RUN php /usr/local/composer-setup.php --install-dir=/usr/local/bin --filename=composer
9+
10+
RUN rm /usr/local/composer-setup.php

composer.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"name": "xefi/faker-php-countries",
3+
"type": "library",
4+
"version": "1.0.0",
5+
"description": "Faker extension to manipulate countries",
6+
"keywords": [
7+
"faker",
8+
"data",
9+
"seeding",
10+
"fixtures"
11+
],
12+
"license": "MIT",
13+
"authors": [
14+
{
15+
"name": "Gaël Botton"
16+
},
17+
{
18+
"name": "Martin Soenen"
19+
}
20+
],
21+
"require": {
22+
"php": "^8.3",
23+
"psr/container": "^2.0",
24+
"xefi/faker-php": "^1"
25+
},
26+
"require-dev": {
27+
"phpunit/phpunit": "^11"
28+
},
29+
"autoload": {
30+
"psr-4": {
31+
"Xefi\\Faker\\Countries\\": "src/"
32+
}
33+
},
34+
"autoload-dev": {
35+
"psr-4": {
36+
"Xefi\\Faker\\Countries\\Tests\\": "tests/"
37+
}
38+
},
39+
"config": {
40+
"sort-packages": true
41+
},
42+
"extra": {
43+
"faker": {
44+
"providers": [
45+
"Xefi\\Faker\\Countries\\CountriesServiceProvider"
46+
]
47+
}
48+
}
49+
}

docker-compose.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
services:
2+
php:
3+
build: .
4+
image: php:latest
5+
volumes:
6+
- ./:/var/www/html
7+
working_dir: /var/www/html
8+
tty: true

phpunit.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
displayDetailsOnTestsThatTriggerWarnings="true"
7+
displayDetailsOnTestsThatTriggerDeprecations="true"
8+
backupStaticProperties="true"
9+
>
10+
<testsuites>
11+
<testsuite name="Unit">
12+
<directory>tests/Unit</directory>
13+
</testsuite>
14+
</testsuites>
15+
<source>
16+
<include>
17+
<directory>src</directory>
18+
</include>
19+
</source>
20+
<php>
21+
</php>
22+
</phpunit>

src/CountriesServiceProvider.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Xefi\Faker\Countries;
4+
5+
use Xefi\Faker\Countries\Extensions\CountriesExtension;
6+
use Xefi\Faker\Providers\Provider;
7+
8+
class CountriesServiceProvider extends Provider
9+
{
10+
public function boot(): void
11+
{
12+
$this->extensions([
13+
CountriesExtension::class
14+
]);
15+
}
16+
}

src/Extensions/CountriesExtension.php

Lines changed: 254 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)