Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
antonkomarev committed Jan 4, 2024
0 parents commit be4ec3a
Show file tree
Hide file tree
Showing 21 changed files with 990 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .docker/php/php81/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# ----------------------
# The FPM base container
# ----------------------
FROM php:8.1-cli-alpine AS dev

RUN apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
libxml2-dev

# Install php extensions
RUN docker-php-ext-install \
xml

# Cleanup apk cache and temp files
RUN rm -rf /var/cache/apk/* /tmp/*

# ----------------------
# Composer install step
# ----------------------

# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# ----------------------
# The FPM production container
# ----------------------
FROM dev
27 changes: 27 additions & 0 deletions .docker/php/php82/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# ----------------------
# The FPM base container
# ----------------------
FROM php:8.2-cli-alpine AS dev

RUN apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
libxml2-dev

# Install php extensions
RUN docker-php-ext-install \
xml

# Cleanup apk cache and temp files
RUN rm -rf /var/cache/apk/* /tmp/*

# ----------------------
# Composer install step
# ----------------------

# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# ----------------------
# The FPM production container
# ----------------------
FROM dev
27 changes: 27 additions & 0 deletions .docker/php/php83/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# ----------------------
# The FPM base container
# ----------------------
FROM php:8.3-cli-alpine AS dev

RUN apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
libxml2-dev

# Install php extensions
RUN docker-php-ext-install \
xml

# Cleanup apk cache and temp files
RUN rm -rf /var/cache/apk/* /tmp/*

# ----------------------
# Composer install step
# ----------------------

# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# ----------------------
# The FPM production container
# ----------------------
FROM dev
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

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

[*.md]
trim_trailing_whitespace = false

[*.{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 @@
* text=auto

/.docker export-ignore
/.github export-ignore
/tests export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/CODE_OF_CONDUCT.md export-ignore
/CONTRIBUTING.md export-ignore
/docker-compose.yaml export-ignore
/phpunit.xml.dist export-ignore
41 changes: 41 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: tests

on: [ push, pull_request ]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest ]
php: [ 7.4, 8.0, 8.1, 8.2 ]
dependency-version: [ prefer-lowest, prefer-stable ]

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

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

- name: Cache dependencies
uses: actions/cache@v2
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: mbstring
tools: composer:v2
coverage: none

- name: Install dependencies
run: |
composer install --no-interaction
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/phpunit --testdox
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/.idea/
/vendor/
.phpunit.result.cache
composer.lock
phpunit.xml
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023, Anton Komarev <[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.
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# PHP SVG Font

<p align="center">
<a href="https://github.com/cybercog/php-svg-font/releases"><img src="https://img.shields.io/github/release/cybercog/php-svg-font.svg?style=flat-square" alt="Releases"></a>
<a href="https://github.com/cybercog/php-svg-font/actions/workflows/tests.yml"><img src="https://img.shields.io/github/actions/workflow/status/cybercog/php-svg-font/tests.yml?style=flat-square" alt="Build"></a>
<a href="https://github.com/cybercog/php-svg-font/blob/master/LICENSE"><img src="https://img.shields.io/github/license/cybercog/php-svg-font.svg?style=flat-square" alt="License"></a>
</p>

## Introduction

PHP SVG Font files reader and manipulator.

## Installation

Pull in the package through Composer.

```shell
composer require cybercog/php-svg-font
```

## Usage

### Instantiate FontList object

```php
$fontList = \Cog\SvgFont\FontList::ofFile(__DIR__ . '/DejaVuSans.svg');
```

### Retrieve SvgFont object from the FontList

```php
$font = \Cog\SvgFont\FontList::ofFile(__DIR__ . '/DejaVuSans.svg')->getById('DejaVuSans');
```

### Project status & release process

While this library is still under development, but we are using it on production environments.

The current releases are numbered `0.x.y`. When a non-breaking change is introduced (adding new methods, optimizing
existing code, etc.), `y` is incremented.

**When a breaking change is introduced, a new `0.x` version cycle is always started.**

It is therefore safe to lock your project to a given release cycle, such as `^0.1`.

If you need to upgrade to a newer release cycle, check the [release history](https://github.com/cybercog/php-svg-font/releases)
for a list of changes introduced by each further `0.x.0` version.

## License

- `PHP SVG Font` package is open-sourced software licensed under the [MIT license](LICENSE) by [Anton Komarev].

## About CyberCog

[CyberCog] is a Social Unity of enthusiasts. Research the best solutions in product & software development is our passion.

- [Follow us on Twitter](https://twitter.com/cybercog)

<a href="https://cybercog.su"><img src="https://cloud.githubusercontent.com/assets/1849174/18418932/e9edb390-7860-11e6-8a43-aa3fad524664.png" alt="CyberCog"></a>

[Anton Komarev]: https://komarev.com
[CyberCog]: https://cybercog.su
46 changes: 46 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "cybercog/php-svg-font",
"description": "PHP SVG font parser",
"type": "library",
"license": "MIT",
"keywords": [
"svg",
"font",
"glyph",
"typography"
],
"authors": [
{
"name": "Anton Komarev",
"email": "[email protected]",
"homepage": "https://komarev.com",
"role": "Developer"
}
],
"autoload": {
"psr-4": {
"Cog\\SvgFont\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Test\\Unit\\Cog\\SvgFont\\": "test/"
}
},
"require": {
"php": "^8.1",
"cybercog/php-unicode": "^1.0"
},
"require-dev": {
"ext-simplexml": "*",
"phpunit/phpunit": "^10.5"
},
"suggest": {
"ext-simplexml": "*"
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable" : true
}
34 changes: 34 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: "3.9"
services:
php81:
container_name: php-svg-font-lib-81
image: php-svg-font-lib
build:
context: ./
dockerfile: ./.docker/php81/Dockerfile
tty: true
working_dir: /app
volumes:
- ./:/app

php82:
container_name: php-svg-font-lib-82
image: php-svg-font-lib
build:
context: ./
dockerfile: ./.docker/php82/Dockerfile
tty: true
working_dir: /app
volumes:
- ./:/app

php83:
container_name: php-svg-font-lib-83
image: php-svg-font-lib
build:
context: ./
dockerfile: ./.docker/php83/Dockerfile
tty: true
working_dir: /app
volumes:
- ./:/app
13 changes: 13 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./test/Unit</directory>
</testsuite>
</testsuites>
</phpunit>
Loading

0 comments on commit be4ec3a

Please sign in to comment.