Skip to content

Commit

Permalink
release: v3.0.0 (#41)
Browse files Browse the repository at this point in the history
See CHANGELOG.md for more details
  • Loading branch information
neoncitylights authored Dec 13, 2024
1 parent f5a68d5 commit aafef13
Show file tree
Hide file tree
Showing 17 changed files with 859 additions and 849 deletions.
10 changes: 2 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ updates:
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps/composer):"
labels:
- "t-dependencies"
- "pkg-composer"
prefix: "deps(composer):"
groups:
mediawiki:
patterns:
Expand All @@ -32,8 +29,5 @@ updates:
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps/actions):"
labels:
- "t-dependencies"
- "pkg-gh-actions"
prefix: "deps(gha):"
open-pull-requests-limit: 4
11 changes: 9 additions & 2 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php:
- '8.1'
php:
- '8.2'
- '8.3'
- '8.4'

steps:
- name: Checkout repository
Expand All @@ -38,3 +39,9 @@ jobs:
run: composer install --prefer-dist --no-progress
- name: Run test suite
run: composer test
- name: Upload code coverage
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
files: coverage.xml
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ phpdoc.xml

# code coverage
coverage
coverage.*

# PHPActor LSP
.phpactor.json
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Changelog

## v3.0.0 (2024-12-12)
This change bumps `neoncitylights/media-type` from v1.0.0 to v3.1.0 with some other changes listed below to accomodate the dependency bump, and minor cleanup.

### Breaking changes
- This library's minimum PHP version was bumped from v8.1 to v8.2 (`neoncitylights/media-type` requires PHP v8.2).
- `InvalidDataUrlSyntaxException` was renamed to `DataUrlParserException`.
- `DataUrlParser->parse()`/`parseOrThrow()` can now also throw `MediaTypeParserException` if the media type cannot be parsed.

### Deprecated
- Calling `DataUrlParser->parse()` is now deprecated. Instead, call `DataUrlParser->parseOrThrow()`. This method been renamed to be more explicit in side effects (throwing an exception).
- Creating a new `DataUrlParser` instance without any arguments is now deprecated. Instead, pass in an instance of `Neoncitylights\MediaType\MediaTypeParser` as an argument, like so:
```php
use Neoncitylights\DataUrl\DataUrlParser;
use Neoncitylights\MediaType\MediaTypeParser;

$dataUrlParser = new DataUrlParser( new MediaTypeParser() );
```

### Features
- `DataUrlParser` has a new instance method, `parseOrNull()`, which either returns `DataUrl` or `null`. This method is an alternative to `parseOrThrow()`.

### Internal changes
- The private properties of `MediaType` are now strongly type-hinted. Note that these were already technically typehinted since they were private, and the constructor signature was already typehinted.
- The library's CI now also runs builds against PHP v8.3 and PHP v8.4 (not just PHP v8.2).
- `mediawiki/mediawiki-sniffer` was bumped from v33.0.0 to v45.0.0.
- `mediawiki/minus-x` was bumped from v1.1.0 to v1.1.3.
- `php-parallel-lint/php-console-highlighter` was bumped from v0.5.0 to v1.0.0.
- `php-parallel-lint/php-parallel-lint` was bumped from v1.2.0 to v1.4.0.
- `phpunit/phpunit` was bumped from v9.4 to v11.5.1.

## v2.0.0 (2020-11-12)
This release included a small unit test for retrieving a media type parameter value.

**Note**: This version did not include any major breaking changes; the version was mistakenly bumped from v1.0.0 to v2.0.0, instead of to v1.0.1.

## v1.0.0 (2020-)
Initial release of the library.
34 changes: 25 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
# DataUrl
![Packagist Version](https://img.shields.io/packagist/v/neoncitylights/data-url)
![GitHub](https://img.shields.io/github/license/neoncitylights/php-data-url)
[![PHP Composer](https://github.com/neoncitylights/php-data-url/actions/workflows/php.yml/badge.svg)](https://github.com/neoncitylights/php-data-url/actions/workflows/php.yml)
[![codecov](https://codecov.io/gh/neoncitylights/php-data-url/branch/main/graph/badge.svg?token=IdWjeqFQcS)](https://codecov.io/gh/neoncitylights/php-data-url)
[![Packagist][packagist-badge]][packagist-url]
[![License][license-badge]][license-url]
[![CI][ci-badge]][ci-url]
[![Codecov][codecov-badge]][codecov-url]

[packagist-badge]: https://img.shields.io/packagist/v/neoncitylights/data-url?style=flat-square
[packagist-url]: https://packagist.org/packages/neoncitylights/data-url
[license-badge]: https://img.shields.io/badge/License-MIT-blue?style=flat-square
[license-url]: #license
[ci-badge]: https://img.shields.io/github/actions/workflow/status/neoncitylights/php-data-url/.github/workflows/php.yml?style=flat-square
[ci-url]: https://github.com/neoncitylights/php-data-url/actions/workflows/php.yml
[codecov-badge]: https://img.shields.io/codecov/c/github/neoncitylights/php-data-url?style=flat-square
[codecov-url]: https://app.codecov.io/gh/neoncitylights/php-data-url

A small PHP library for dealing with data URLs, which contain a media type and an encoded base64 string.

This library fully conforms to RFC 2397[^rfc-2397].
This library fully conforms to [RFC 2397](https://datatracker.ietf.org/doc/html/rfc2397).

## Install
This requires a minimum PHP version of v8.2.

```
composer require neoncitylights/data-url
```
Expand All @@ -18,9 +29,10 @@ composer require neoncitylights/data-url
<?php

use Neoncitylights\DataUrl\DataUrlParser;
use Neoncitylights\MediaType\MediaTypeParser;

$dataUrlParser = new DataUrlParser();
$dataUrl = $dataUrlParser->parse( 'data:text/plain;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==' );
$dataUrlParser = new DataUrlParser( new MediaTypeParser() );
$dataUrl = $dataUrlParser->parseOrNull( 'data:text/plain;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==' );

print( $dataUrl->getMediaType()->getEssence() );
// 'text/plain'
Expand All @@ -33,6 +45,10 @@ print( $dataUrl->getDecodedValue() );
```

## License
DataUrl is licensed under the [MIT license](/LICENSE).
This software is licensed under the MIT license ([`LICENSE`](./LICENSE) or
<https://opensource.org/license/mit/>).

[^rfc-2397]: Masinter, L., &amp; X. (1998, August). The "data" URL scheme. Retrieved October 30, 2020, from <https://tools.ietf.org/html/rfc2397>
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the MIT license, shall be
licensed as above, without any additional terms or conditions.
11 changes: 5 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "neoncitylights/data-url",
"authors": [
{
"name": "Samantha Nguyen"
"name": "Samantha Nguyen",
"email": "[email protected]"
}
],
"license": "MIT",
Expand All @@ -29,16 +30,15 @@
}
},
"require": {
"neoncitylights/media-type": "^1.0",
"php": ">= 8.1"
"neoncitylights/media-type": "^3.1.0",
"php": ">= 8.2"
},
"require-dev": {
"mediawiki/mediawiki-codesniffer": "45.0.0",
"mediawiki/minus-x": "1.1.3",
"ockcyp/covers-validator": "1.6.0",
"php-parallel-lint/php-console-highlighter": "1.0.0",
"php-parallel-lint/php-parallel-lint": "1.4.0",
"phpunit/phpunit": "9.6.19"
"phpunit/phpunit": "11.5.1"
},
"scripts": {
"lint": "parallel-lint . --exclude vendor --exclude node_modules",
Expand All @@ -49,7 +49,6 @@
"test": [
"@lint",
"@phpcs",
"covers-validator",
"@test:phpunit-clover",
"minus-x check ."
],
Expand Down
Loading

0 comments on commit aafef13

Please sign in to comment.