Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: netglue/prismic-client
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.4.0
Choose a base ref
...
head repository: netglue/prismic-client
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.14.x
Choose a head ref
Loading
Showing with 4,539 additions and 3,198 deletions.
  1. +6 −0 .gitattributes
  2. +0 −10 .github/dependabot.yml
  3. +36 −20 .github/workflows/continuous-integration.yml
  4. +0 −24 .github/workflows/merge-dependabot-upgrades.yml
  5. +6 −58 .github/workflows/release-on-milestone-closed.yml
  6. +4 −0 .gitignore
  7. +4 −16 .laminas-ci.json
  8. +0 −13 .laminas-ci/post-run.sh
  9. +54 −0 Makefile
  10. +5 −5 README.md
  11. +0 −16 composer-require-checker.json
  12. +22 −18 composer.json
  13. +3,193 −1,984 composer.lock
  14. +5 −7 phpcs.xml
  15. +15 −3 phpunit.xml.dist
  16. +7 −1 psalm-baseline.xml
  17. +25 −11 psalm.xml
  18. +6 −0 renovate.json
  19. +38 −71 src/Api.php
  20. +7 −7 src/ApiClient.php
  21. +2 −2 src/DefaultLinkResolver.php
  22. +1 −1 src/Document.php
  23. +2 −3 src/Document/DocumentDataConsumer.php
  24. +21 −5 src/Document/Fragment/BaseCollection.php
  25. +1 −5 src/Document/Fragment/BooleanFragment.php
  26. +6 −8 src/Document/Fragment/Color.php
  27. +1 −6 src/Document/Fragment/DateFragment.php
  28. +10 −25 src/Document/Fragment/DocumentLink.php
  29. +25 −40 src/Document/Fragment/Embed.php
  30. +36 −16 src/Document/Fragment/Factory.php
  31. +1 −9 src/Document/Fragment/GeoPoint.php
  32. +17 −38 src/Document/Fragment/Image.php
  33. +6 −22 src/Document/Fragment/ImageLink.php
  34. +4 −14 src/Document/Fragment/MediaLink.php
  35. +8 −8 src/Document/Fragment/Number.php
  36. +1 −0 src/Document/Fragment/OrderedList.php
  37. +1 −0 src/Document/Fragment/RichText.php
  38. +55 −21 src/Document/Fragment/Slice.php
  39. +10 −21 src/Document/Fragment/Span.php
  40. +1 −5 src/Document/Fragment/StringFragment.php
  41. +11 −19 src/Document/Fragment/TextElement.php
  42. +1 −0 src/Document/Fragment/UnorderedList.php
  43. +4 −11 src/Document/Fragment/WebLink.php
  44. +5 −0 src/Document/FragmentCollection.php
  45. +8 −13 src/Exception/InvalidArgument.php
  46. +4 −5 src/Exception/JsonError.php
  47. +4 −5 src/Exception/PreviewTokenExpired.php
  48. +5 −8 src/Exception/RequestFailure.php
  49. +9 −6 src/Json.php
  50. +1 −1 src/LinkResolver.php
  51. +112 −34 src/Predicate.php
  52. +9 −9 src/Query.php
  53. +4 −4 src/ResultSet.php
  54. +9 −9 src/ResultSet/StandardResultSet.php
  55. +10 −22 src/ResultSet/TypicalResultSetBehaviour.php
  56. +18 −26 src/Serializer/HtmlSerializer.php
  57. +14 −29 src/Value/ApiData.php
  58. +1 −8 src/Value/Bookmark.php
  59. +27 −7 src/Value/DataAssertionBehaviour.php
  60. +10 −31 src/Value/DocumentData.php
  61. +9 −19 src/Value/FormField.php
  62. +12 −29 src/Value/FormSpec.php
  63. +1 −9 src/Value/Language.php
  64. +26 −18 src/Value/Ref.php
  65. +8 −17 src/Value/Translation.php
  66. +1 −8 src/Value/Type.php
  67. +23 −11 test/Smoke/ApiTest.php
  68. +8 −7 test/Smoke/CacheTest.php
  69. +6 −5 test/Smoke/Example/ExampleHydratingResultSetTest.php
  70. +3 −2 test/Smoke/PredicateUseCaseTest.php
  71. +2 −1 test/Smoke/PreviewExpiryTest.php
  72. +4 −3 test/Smoke/QueryTest.php
  73. +4 −3 test/Smoke/Serializer/HtmlSerializerTest.php
  74. +22 −24 test/Smoke/TestCase.php
  75. +17 −26 test/Unit/ApiTest.php
  76. +3 −4 test/Unit/Document/DocumentDataConsumerTest.php
  77. +4 −3 test/Unit/Document/Fragment/BooleanFragmentTest.php
  78. +3 −2 test/Unit/Document/Fragment/ColorTest.php
  79. +9 −8 test/Unit/Document/Fragment/DocumentLinkTest.php
  80. +9 −8 test/Unit/Document/Fragment/EmbedTest.php
  81. +3 −2 test/Unit/Document/Fragment/EmptyFragmentTest.php
  82. +39 −10 test/Unit/Document/Fragment/FactoryTest.php
  83. +4 −3 test/Unit/Document/Fragment/GeoPointTest.php
  84. +7 −6 test/Unit/Document/Fragment/ImageLinkTest.php
  85. +2 −2 test/Unit/Document/Fragment/ImageTest.php
  86. +5 −4 test/Unit/Document/Fragment/MediaLinkTest.php
  87. +8 −6 test/Unit/Document/Fragment/NumberTest.php
  88. +54 −7 test/Unit/Document/Fragment/SliceTest.php
  89. +11 −9 test/Unit/Document/Fragment/TextElementTest.php
  90. +9 −17 test/Unit/Exception/PreviewTokenExpiredTest.php
  91. +8 −3 test/Unit/Framework/TestCase.php
  92. +13 −6 test/Unit/JsonTest.php
  93. +33 −62 test/Unit/PredicateTest.php
  94. +66 −60 test/Unit/QueryTest.php
  95. +2 −2 test/Unit/ResultSet/StandardResultTest.php
  96. +7 −6 test/Unit/Serializer/HtmlSerializerTest.php
  97. +1 −1 test/Unit/TestLinkResolver.php
  98. +11 −3 test/Unit/Value/ApiDataTest.php
  99. +6 −6 test/Unit/Value/DocumentDataTest.php
  100. +7 −14 test/Unit/Value/FormFieldTest.php
  101. +4 −2 test/Unit/Value/FormSpecTest.php
  102. +52 −0 test/Unit/Value/RefTest.php
  103. +5 −0 test/Unit/Value/TypeTest.php
  104. +78 −0 test/fixture/api-data-without-bookmarks.json
  105. +22 −0 test/fixture/basic-slices.json
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/.github export-ignore
/.laminas-ci.json export-ignore
/composer.lock export-ignore
/phpcs.xml export-ignore
/phpunit.xml.dist export-ignore
/psalm.xml export-ignore
/psalm-baseline.xml export-ignore
/test/ export-ignore
/Makefile export-ignore
/renovate.json export-ignore
10 changes: 0 additions & 10 deletions .github/dependabot.yml

This file was deleted.

56 changes: 36 additions & 20 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -4,31 +4,47 @@ on:
pull_request:
push:
branches:
- '[0-9]+.[0-9]+.x'
tags:

jobs:
matrix:
name: Generate job matrix
ci:
uses: laminas/workflow-continuous-integration/.github/workflows/continuous-integration.yml@1.x
coverage:
name: PHPUnit Coverage
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Gather CI configuration
id: matrix
uses: laminas/laminas-ci-matrix-action@v1

qa:
name: QA Checks
needs: [matrix]
runs-on: ${{ matrix.operatingSystem }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }}
steps:
- name: ${{ matrix.name }}
- uses: actions/checkout@v4.2.2
- uses: shivammathur/setup-php@2.32.0
with:
php-version: 8.2
extensions: pcov
coverage: pcov
ini-values: pcov.enabled=1
- uses: "ramsey/composer-install@3.1.0"
- run: php ./vendor/bin/phpunit --coverage-clover=coverage.xml
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
PRISMIC_REPO: ${{ secrets.PRISMIC_REPO }}
uses: laminas/laminas-continuous-integration-action@v1
PRISMIC_TOKEN: ${{ secrets.PRISMIC_TOKEN }}

- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: false

composer-require-checker:
name: "Check for missing dependencies"
runs-on: "ubuntu-latest"

steps:
- uses: actions/checkout@v4.2.2
- uses: shivammathur/setup-php@2.32.0
with:
php-version: 8.2
- uses: "ramsey/composer-install@3.1.0"
with:
job: ${{ matrix.job }}
dependency-versions: "highest"
- run: composer global config bin-dir /usr/local/bin
- run: composer global require -W maglnet/composer-require-checker
- run: /usr/local/bin/composer-require-checker check
24 changes: 0 additions & 24 deletions .github/workflows/merge-dependabot-upgrades.yml

This file was deleted.

64 changes: 6 additions & 58 deletions .github/workflows/release-on-milestone-closed.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

name: "Automatic Releases"

on:
@@ -9,59 +7,9 @@ on:

jobs:
release:
name: "GIT tag, release & create merge-up PR"
runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: "actions/checkout@v3"

- name: "Release"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:release"
env:
"GITHUB_TOKEN": ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}

- name: "Create Merge-Up Pull Request"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:create-merge-up-pull-request"
env:
"GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}

- name: "Create and/or Switch to new Release Branch"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:switch-default-branch-to-next-minor"
env:
"GITHUB_TOKEN": ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}

- name: "Bump Changelog Version On Originating Release Branch"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:bump-changelog"
env:
"GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}

- name: "Create new milestones"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:create-milestones"
env:
"GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}
uses: laminas/workflow-automatic-releases/.github/workflows/release-on-milestone-closed.yml@1.x
secrets:
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
ORGANIZATION_ADMIN_TOKEN: ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}
SIGNING_SECRET_KEY: ${{ secrets.SIGNING_SECRET_KEY }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/build/
phpunit.xml
/vendor/
.phpunit.cache
.phpunit.result.cache
.php_cs.cache
rector.php
20 changes: 4 additions & 16 deletions .laminas-ci.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
{
"extensions": [
"pcov"
],
"ini": [
"pcov.enabled=1"
],
"additional_checks": [
{
"name": "Coverage",
"job": {
"command": "vendor/bin/phpunit --coverage-clover coverage.xml"
}
}
],
"ignore_php_platform_requirements": {
"8.1": true
}
"8.3": false,
"8.4": true
},
"backwardCompatibilityCheck": true
}
13 changes: 0 additions & 13 deletions .laminas-ci/post-run.sh

This file was deleted.

54 changes: 54 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Run `make` (no arguments) to get a short description of what is available
# within this `Makefile`.

help: ## shows this help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_\-\.]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.PHONY: help

install: ## Install PHP dependencies
composer install
.PHONY: install

update: ## Update PHP dependencies
composer update
.PHONY: update

bump: ## Update PHP dependencies
composer update
composer bump -D
composer update
.PHONY: update

clean: ## Clear out caches
rm -rf .phpunit.cache
rm -f .php_cs-cache
vendor/bin/psalm --clear-cache

sa: ## Run static analysis checks
vendor/bin/psalm --no-cache --threads=1
.PHONY: sa

cs: ## Run coding standards checks
vendor/bin/phpcs
.PHONY: cs

test: ## Run unit tests
vendor/bin/phpunit
.PHONY: test

qa: cs sa test ## Run all QA Checks
.PHONY: check

get-rector: ## Install rector as a dev dependency
ifeq (,$(wildcard ./vendor/bin/rector))
composer require --dev rector/rector
endif
.PHONY: get-rector

remove-rector: ## Remove rector dependency
composer remove --dev rector/rector
.PHONY: remove-rector

rector: get-rector ## Run Rector
vendor/bin/rector
.PHONY: rector
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://vshymanskyy.github.io/StandWithUkraine)

# PHP Api Client for Prismic.io

[![Build Status](https://github.com/netglue/prismic-client/workflows/Continuous%20Integration/badge.svg)](https://github.com/netglue/prismic-client/actions?query=workflow%3A"Continuous+Integration")
[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://vshymanskyy.github.io/StandWithUkraine)

[![Build Status](https://github.com/netglue/prismic-client/workflows/Continuous%20Integration/badge.svg)](https://github.com/netglue/prismic-client/actions?query=workflow%3A"Continuous+Integration")
[![codecov](https://codecov.io/gh/netglue/prismic-client/branch/main/graph/badge.svg)](https://codecov.io/gh/netglue/prismic-client)
[![Psalm Type Coverage](https://shepherd.dev/github/netglue/prismic-client/coverage.svg)](https://shepherd.dev/github/netglue/prismic-client)
[![Latest Stable Version](https://poser.pugx.org/netglue/prismic-client/v/stable)](https://packagist.org/packages/netglue/prismic-client)
@@ -31,7 +31,7 @@ There is practically zero backwards compatibility with other prismic clients so

## Installation

Install with composer: `composer require netglue/prismic-client`
Install with composer: `composer require netglue/prismic-client`

You will also require a PSR-18 HTTP client implementation, of which there are many, for example:

@@ -46,7 +46,7 @@ Docs are a work in progress and are hosted in a public prismic repository _(obvi

You can view the docs by cloning the library, cd to the source and issue a `composer install` followed by a `composer serve`. This will start up PHP's built-in server on [http://127.0.0.1:8080](http://127.0.0.1:8080) showing the docs.

#### Samples & Examples
### Samples & Examples

Take a look around in the `./samples` directory; that's where you’ll find the document explorer used for rendering the documentation and examples for setting up hydrating result sets, link resolver implementations and other stuff.

16 changes: 0 additions & 16 deletions composer-require-checker.json

This file was deleted.

40 changes: 22 additions & 18 deletions composer.json
Original file line number Diff line number Diff line change
@@ -15,7 +15,11 @@
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"composer/package-versions-deprecated": true
"composer/package-versions-deprecated": true,
"php-http/discovery": false
},
"platform": {
"php": "8.2.99"
}
},
"autoload": {
@@ -31,32 +35,32 @@
}
},
"require": {
"php": "^7.4 || ~8.0 || ~8.1",
"php": "~8.2 || ~8.3 || ~8.4",
"ext-json": "*",
"laminas/laminas-escaper": "^2.9",
"php-http/discovery": "^1.14.1",
"psr/cache": "^1.0.0 || ^2.0.0",
"php-http/discovery": "^1.18.0",
"psr/cache": "^1.0.0 || ^2.0.0 || ^3.0.0",
"psr/http-client-implementation": "*",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0",
"symfony/polyfill-php80": "^1.17"
"psr/http-message": "^1.0 || ^2.0"
},
"require-dev": {
"ext-curl": "*",
"doctrine/coding-standard": "^10.0",
"laminas/laminas-diactoros": "^2.13.0",
"maglnet/composer-require-checker": "^3.8.0",
"php-http/cache-plugin": "^1.7",
"php-http/curl-client": "^2.2",
"php-http/mock-client": "^1.5",
"phpunit/phpunit": "^9.5",
"psalm/plugin-phpunit": "^0.17.0",
"doctrine/coding-standard": "^12.0",
"laminas/laminas-diactoros": "^3.5.0",
"php-http/cache-plugin": "^2.0.1",
"php-http/curl-client": "^2.3.3",
"php-http/mock-client": "^1.6.1",
"phpunit/phpunit": "^11.5.4",
"psalm/plugin-phpunit": "^0.19.2",
"roave/security-advisories": "dev-latest",
"squizlabs/php_codesniffer": "^3.7.1",
"symfony/cache": "^5.4 || ^6.0.0",
"symfony/options-resolver": "^5.4 || ^6.0",
"vimeo/psalm": "^4.26.0"
"symfony/cache": "^6.4.13 || ^7.2.3",
"vimeo/psalm": "^6.0.0"
},
"conflict": {
"php-http/httplug": "<2.4.1",
"php-http/promise": "<1.3.1"
},
"scripts": {
"check": [
Loading