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

Use Symfony\Filesystem for file operations #83

Open
nettles-jarrod opened this issue Mar 10, 2013 · 8 comments
Open

Use Symfony\Filesystem for file operations #83

nettles-jarrod opened this issue Mar 10, 2013 · 8 comments
Assignees
Milestone

Comments

@nettles-jarrod
Copy link
Collaborator

This has been on my mind for some time but this issue brought it to my attention a little harder. The issue is for the 1.0 branch but it effects 2.0 as well.

Instead of rolling our own filesystem code, I propose use a library specifically designed to handle these sorts of things. That way PHPThumb is focused on images, and not filesystem operations.

Also, abstracting out our operations will allow us to mock those operations, enhancing our unit testing capabilities.

@ghost ghost assigned nettles-jarrod Mar 10, 2013
@mikealmond
Copy link
Contributor

For the amount of filesystem operations this library does I'm not sure requiring another library would be beneficial. Wouldn't SplFileInfo and SplFileObject work instead? http://www.php.net/manual/en/spl.files.php

@nettles-jarrod
Copy link
Collaborator Author

Yeah. After digging in and using it a couple weeks ago I realized that Symfony\Filesystem doesn't really buy us that much. We can drop it as a dependency.

@okaresz
Copy link

okaresz commented Oct 12, 2013

Then why it hasn't been dropped yet?...

This is a nice light-weight image lib (just what i was looking for), but now I must alter it to use. It's completely unnecessary to bring in a lib dependence for a single file existence check.

@nettles-jarrod
Copy link
Collaborator Author

Yup. Which is why we said we'll drop it. Feel free to submit a pull request if you have time to work on it.

@ghost
Copy link

ghost commented Jan 23, 2014

I have same problem with the thing. I think phpthumb should use is_file instead of symfony filesystem. Why you don't use built-in function, that is better ?

@nettles-jarrod
Copy link
Collaborator Author

Again, feel free to submit a pull request fixing this. I don't have time to work on this library anymore. :(

@ghost
Copy link

ghost commented Jun 11, 2014

A pull request for three lines of changes?

Here are the changes to make it easy:
in PHPThumb.php:

remove line 62.

change what is now line 91 to read:
if(file_exists($filename)) {
instead of
if($this->filesystem->exists($filename)) {

Remove the requirement from Composer.json.

@cogentParadigm
Copy link
Contributor

I created a pull request #127

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

No branches or pull requests

4 participants