Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major version: v3 #230

Merged
merged 38 commits into from
Jun 10, 2024
Merged

Major version: v3 #230

merged 38 commits into from
Jun 10, 2024

Conversation

patinthehat
Copy link
Collaborator

@patinthehat patinthehat commented May 28, 2024

This PR updates the package to a new major version, v3.0.0.

Major changes:

  • Dropped support for PHP versions < 8.2.
  • Many breaking API changes (see below).
  • Added support for saving multiple pages to images using selectPages().
  • Native Backed Enum implementations to enforce allowed values in several places.
  • Dropped support for reading remote PDF files for security reasons.
  • Added property, argument and return types.
  • Removed Imagick instance creation in constructor, replaced calls to readImage() with pingImage() (test suite runs ~33% faster).

Breaking API Changes

There are breaking API changes from v2 to v3. I feel that these changes streamline the developer experience, enhance understanding of the functionality of the methods, and in some cases reduce cognitive overload by simplifying method names. See the modified README.md for a full list of the new API methods and method names.

Additional Changes

  • php-cs-fixer configuration and workflow was dropped in favor of Laravel Pint.
  • Readme updated to include all available methods, fix a few grammatical errors, etc.
  • Fixed several minor, previously unknown bugs.
  • Test coverage increased from ~65% to ~93%.
  • Pest upgraded to v2, migrated PHPUnit configuration to v10.
  • Unit tests were reorganized/restructured to be more manageable, and Pest configuration files were added.

Copy link
Member

@Nielsvanpach Nielsvanpach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

I just had a quick scan through the code, as I'm not familiar with this package.

src/DTOs/PdfPage.php Outdated Show resolved Hide resolved
src/DTOs/PdfPage.php Outdated Show resolved Hide resolved
@patinthehat patinthehat requested a review from jefvdv May 28, 2024 17:47
@patinthehat
Copy link
Collaborator Author

Hey @freekmurze or @AlexVanderbist, please review this new major version PR if time permits. Thanks! 👍

Copy link
Member

@freekmurze freekmurze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice work! Thank you for this

src/Enums/LayerMethod.php Show resolved Hide resolved
src/Exceptions/InvalidLayerMethod.php Outdated Show resolved Hide resolved
src/Exceptions/InvalidSize.php Outdated Show resolved Hide resolved
src/Pdf.php Outdated Show resolved Hide resolved

class PdfPage
{
public function __construct(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A protected constructor for DTOs or VOs makes it easier to refactor or extend in the future.

Suggested change
public function __construct(
protected function __construct(

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nielsvanpach Could you elaborate on this and/or is it Spatie practice to make DTO constructors protected? I'm definitely leaning towards agreement, but if you could expand a bit I'd appreciate it 👍

src/Exceptions/InvalidLayerMethod.php Outdated Show resolved Hide resolved
@patinthehat patinthehat merged commit b145cf4 into main Jun 10, 2024
10 checks passed
@patinthehat patinthehat deleted the v3 branch June 10, 2024 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants