这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@labmecanicatec
Copy link
Contributor

MobilDetec, phpqrcode, feedwriter, icalreader, is_email, PHPMailer, SimpleImage, and Unirest libraries are migrated or replaced via Composer

  • MobilDetect from 2.8.37 to 4.8
  • phpqrcode is replaced by bacon/bacon-qr-code 3.0
  • FeedItem is replaced by mibe/feedwriter
  • icalreader is replaced by sabre/vobject 4.5
  • is_email is replaced by egulias/email-validator 4.0
  • PHPMailer 5 is updated to 6.10
  • remove random, native PHP random functions are used
  • SimpleImage is updated to claviska/simpleimage 4.2
  • Unirest is updated to mashape/unirest-php 3.0
  • According to the documentation for each dependency, the minimum requirement of PHP 8.1 is maintained
  • Tested on php 8.2 and 8.4
  • It remains to be seen whether the Slim and Pear libraries can be migrated via Composer

@JohnVillalovos
Copy link
Contributor

@labmecanicatec Thanks for the PR. Can you resolve the CI issues? Let me know if you need any assistance. Thanks!

@labmecanicatec
Copy link
Contributor Author

Hi @JohnVillalovos , I would appreciate any help you can give me, the truth is I am new to collaborating with repositories.

composer.json Outdated
"phpmailer/phpmailer": "^6.10",
"claviska/simpleimage": "^4.2"
"claviska/simpleimage": "^4.2",
"mashape/unirest-php": "3.0.4"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be: "mashape/unirest-php": "^3.0"

Or would it break something?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is to resolve the composer validate --strict error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it doesn't break anything. But how do I fix the commit messages?

@JohnVillalovos
Copy link
Contributor

@labmecanicatec To fix the commit messages look at: https://github.com/LibreBooking/app/blob/develop/CONTRIBUTING.md#commit-message-guidelines

So for example on the first commit. Could change the current commit message title from: "add MobileDetect via Composer" to "fix: add MobileDetect via Composer"

The commit message: "refactor: use Composer version of MobileDetect library" is good 👍

And "delete unused Mobile_Detect.php (replaced by Composer version)" could be "refactor: delete unused Mobile_Detect.php" The "(replaced by Composer version)" would probably be best in the commit body.

And do the same thing for the rest.

If you want I could take a stab at updating all the commit messages. I could do it later on today. Just let me know. I'm happy to do it.

@JohnVillalovos JohnVillalovos requested a review from Copilot June 7, 2025 03:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates various manually included libraries to Composer-managed dependencies and updates application code to use new namespaces and APIs.

  • Removed legacy lib/external library copies and added Composer packages for HTTP (Unirest), image processing, QR codes, feeds, iCal parsing, email validation, mailing, and randomness.
  • Updated require_once loading to use Composer autoload and use statements, and adjusted method calls to match new library APIs.
  • Refactored presenters, pages, services, and the payment gateway to align with updated dependencies and PHP 8.1+ requirements.

Reviewed Changes

Copilot reviewed 66 out of 66 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
lib/external/Unirest/… Deleted old Unirest source; now use mashape/unirest-php
lib/external/SimpleImage/SimpleImage.php Removed legacy SimpleImage; replaced by claviska/simpleimage
lib/external/FeedWriter/FeedItem.php Deleted old FeedWriter item; now use mibe/feedwriter
lib/Graphics/namespace.php Dropped manual QR generator include
lib/Graphics/QRGenerator.php Removed old PHPQRCode wrapper
lib/Graphics/ImageFactory.php Switched to claviska\SimpleImage and wrapped fromFile
lib/Graphics/Image.php Updated wrapper to call bestFit and toFile on new SimpleImage
lib/Email/EmailService.php Migrated to PHPMailer 6 namespace, configurable transport
lib/Common/Validators/EmailValidator.php Replaced is_email with egulias/email-validator
lib/Common/Helpers/String.php Removed random library include
composer.json Added new dependency entries for all migrated libraries
Presenters/Admin/ManageResourcesPresenter.php Replaced old QRGenerator with BaconQrCode, updated case block style
Presenters/Admin/Import/ICalImportPresenter.php Switched from icalreader to sabre/vobject reader
Pages/Page.php Updated Mobile_Detect to Detection\MobileDetect
Pages/Export/AtomSubscriptionPage.php Swapped FeedWriter for \FeedWriter\ATOM, updated feed output call
Domain/PaymentGateway.php Removed Unirest include, updated PayPal sandbox URL, Stripe catches
Comments suppressed due to low confidence (2)

Presenters/Admin/ManageResourcesPresenter.php:907

  • The variable $url is undefined here; this will trigger a notice. It should likely use $qrPath (or another defined variable) instead of $url.
        $this->page->ShowQRCode($url, $resource->GetName());

lib/Graphics/ImageFactory.php:23

  • [nitpick] The inline comment is in Spanish; consider translating comments to English to keep the codebase language consistent.
            $image->fromFile($pathToImage); // método correcto en la nueva versión

}
return $path = "$path/$fileName";
;
return $path = "$path/$fileName";;
Copy link

Copilot AI Jun 7, 2025

Choose a reason for hiding this comment

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

[nitpick] Unnecessary assignment and double semicolon. Simplify this to return "$path/$fileName";.

Suggested change
return $path = "$path/$fileName";;
return "$path/$fileName";

Copilot uses AI. Check for mistakes.
Replaced by Composer version
Copy link
Contributor

@JohnVillalovos JohnVillalovos left a comment

Choose a reason for hiding this comment

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

Thanks @labmecanicatec

I translated one comment from Spanish to English.

LGTM (Looks Good To Me).

@JohnVillalovos JohnVillalovos merged commit 12b376d into LibreBooking:develop Jun 7, 2025
7 checks passed
@labmecanicatec labmecanicatec deleted the composer-migrate-deps branch June 7, 2025 13: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.

2 participants