[GH-ISSUE #57] PHP version support / contributing #42

Closed
opened 2026-02-25 23:40:29 +03:00 by kerem · 4 comments
Owner

Originally created by @birkett on GitHub (Jun 20, 2018).
Original GitHub issue: https://github.com/HaschekSolutions/pictshare/issues/57

I want to contribute changes, including:

  • PSR-2 coding standards
  • Refactoring the base classes
  • Updates to follow best practices

Some questions before I go ahead:
Would you be happy dropping support for PHP 5.6? PHP 7 has numerous advantages.
Are there any other coding standard / practices would you like to adhere to?

Originally created by @birkett on GitHub (Jun 20, 2018). Original GitHub issue: https://github.com/HaschekSolutions/pictshare/issues/57 I want to contribute changes, including: - PSR-2 coding standards - Refactoring the base classes - Updates to follow best practices Some questions before I go ahead: Would you be happy dropping support for PHP 5.6? PHP 7 has numerous advantages. Are there any other coding standard / practices would you like to adhere to?
kerem closed this issue 2026-02-25 23:40:29 +03:00
Author
Owner

@geek-at commented on GitHub (Jun 20, 2018):

Hello @birkett!

Thank you for starting this. I too have had two tries on rewriting pictshare to be more readable and moddable. I stopped both attempts because I just didn't have the time.

Dropping PHP 5.6 is okay and also dropping the support for legacy images is okay for me.

I have just two requests for a rewrite:

  1. No composer or piles of external libraries. I hate how bloated projects become that use composer libraries and also there is the security factor.
  2. I want it to be easily modable by which I mean all features should be in extra classes like a "filters" class where all filters like pixelate_10 is defined and another for resizing, etc.

Any thoughts on that?

<!-- gh-comment-id:398790429 --> @geek-at commented on GitHub (Jun 20, 2018): Hello @birkett! Thank you for starting this. I too have had two tries on rewriting pictshare to be more readable and moddable. I stopped both attempts because I just didn't have the time. Dropping PHP 5.6 is okay and also dropping the support for [legacy](https://github.com/chrisiaut/pictshare/search?q=legacy&unscoped_q=legacy) images is okay for me. I have just two requests for a rewrite: 1. No composer or piles of external libraries. I hate how bloated projects become that use composer libraries and also there is the security factor. 2. I want it to be easily modable by which I mean all features should be in extra classes like a "filters" class where all filters like pixelate_10 is defined and another for resizing, etc. Any thoughts on that?
Author
Owner

@birkett commented on GitHub (Jun 20, 2018):

On 1. - I agree, I see no need for third party libraries here.
However, Composer can be useful for bringing in development tools, like PHP CS Fixer. These tools can be installed with require-dev. They would have no impact on, or relationship with the application.

On 2. - This is something I have been looking at. I think we can re-write the filters, one per class - all of which would implement a new interface, FilterInterface, and extend a base filter class, AbstractFilter. We can then create a FilterFactory, and do nice things, like:

$filter = FilterFactory::getResizeFilter();
$filter->setImage($image);
$filter->setParams(
  ['width' => 128, 'height' => 128]
);
$filter->apply();

$anotherFilter = FilterFactory::getBlurFilter();
$anotherFilter->setImage($filter->getImage());
$anotherFilter->setParams(['blur' => 5]);
$anotherFilter->apply();

$anotherFilter->getImage(); // Contains a blurred 128x128 image.

Something similar can be done with the uploaders (Backblaze, local storage...) - put them all on an interface, so they act identically to the application.

I'd like to get started with one big PR, to update the coding standards. This will modify most lines of code, setting the line endings to LF, spaces for indentation etc. This first PR will make no functional changes.

We can then follow with refactoring work, one area at a time. PHP7 support would be dropped at this point, allowing for strict typing, parameter and return type hints.

<!-- gh-comment-id:398878683 --> @birkett commented on GitHub (Jun 20, 2018): On 1. - I agree, I see no need for third party libraries here. However, Composer can be useful for bringing in development tools, like PHP CS Fixer. These tools can be installed with require-dev. They would have no impact on, or relationship with the application. On 2. - This is something I have been looking at. I think we can re-write the filters, one per class - all of which would implement a new interface, FilterInterface, and extend a base filter class, AbstractFilter. We can then create a FilterFactory, and do nice things, like: ``` $filter = FilterFactory::getResizeFilter(); $filter->setImage($image); $filter->setParams( ['width' => 128, 'height' => 128] ); $filter->apply(); $anotherFilter = FilterFactory::getBlurFilter(); $anotherFilter->setImage($filter->getImage()); $anotherFilter->setParams(['blur' => 5]); $anotherFilter->apply(); $anotherFilter->getImage(); // Contains a blurred 128x128 image. ``` Something similar can be done with the uploaders (Backblaze, local storage...) - put them all on an interface, so they act identically to the application. I'd like to get started with one big PR, to update the coding standards. This will modify most lines of code, setting the line endings to LF, spaces for indentation etc. This first PR will make no functional changes. We can then follow with refactoring work, one area at a time. PHP7 support would be dropped at this point, allowing for strict typing, parameter and return type hints.
Author
Owner

@geek-at commented on GitHub (Jun 21, 2018):

Sounds awesome, you have my blessing

<!-- gh-comment-id:398999818 --> @geek-at commented on GitHub (Jun 21, 2018): Sounds awesome, you have my blessing
Author
Owner

@birkett commented on GitHub (Jun 21, 2018):

Filter refactoring in progress here:
github.com/birkett/pictshare@673fd9210a

PR to follow.

<!-- gh-comment-id:399242784 --> @birkett commented on GitHub (Jun 21, 2018): Filter refactoring in progress here: https://github.com/birkett/pictshare/commit/673fd9210ab1f5ea1670c49a25c152f0f52a4234 PR to follow.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/pictshare#42
No description provided.