Skip to content
This repository has been archived by the owner on Aug 11, 2018. It is now read-only.

Find autoload #7

Merged
merged 3 commits into from
Nov 17, 2016
Merged

Find autoload #7

merged 3 commits into from
Nov 17, 2016

Conversation

veger
Copy link
Contributor

@veger veger commented Aug 24, 2016

My vendor/autoload.php is not in the root of my project (as the project contains other stuff besides the source code).

The improved script is able to find any vendor/autoload.php in the project, if it is not found in the root of the project.

Additionally, changed the error message when the autoloader has been found (but the class is not), making it less obnoxious.

veger added 2 commits August 24, 2016 09:15
…ists in your project and is readable' message if vendor/autoload.php has been found at least once.
@harikt
Copy link
Owner

harikt commented Aug 24, 2016

Hi @veger ,

Thank you for the PR. I have a different idea.

How about the users create a vendor/autoload.php file which can return a loader having a findFile method.

So in your case it would be something like

<?php
return require '/path/to/autoloader.php';

I guess that will resolve some other issues like even if there is no composer support. And the code becoming light itself.

What do you think ?

@veger
Copy link
Contributor Author

veger commented Aug 24, 2016

It is a nice idea to keep the code light!

But I am not allowed to add helper files, just to let tooling work, in my project root (company policy). So it is not a solution in my case. :(

@filaruina
Copy link

+1 on this one.
Searching is better than adding a helper file, since it may become a burden due to version control if you're not commiting it.
Also I think this is useful to make the package more "works out of the box". No need to do anything, just use it.

@harikt
Copy link
Owner

harikt commented Nov 12, 2016

Sure. I will consider looking into this again and merge it. Currently sick
and on bed.

On 12-Nov-2016 17:03, "Filipe La Ruina" [email protected] wrote:

+1 on this one.
Searching is better than adding a helper file, since it may become a
burden due to version control if you're not commiting it.
Also I think this is useful to make the package more "works out of the
box". No need to do anything, just use it.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#7 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAHWhpXCIxby-qGH0It-R5wvsHKl0Rjkks5q9aP0gaJpZM4Jrtga
.

$foundAutoLoader = false;

// First try default location
if(is_readable($autoloader)) {
Copy link
Owner

Choose a reason for hiding this comment

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

Hey,

I have a question where did this $autoloader is assigned ? Did you missed / accidentally removed https://github.com/harikt/php-hyperclick/pull/7/files#diff-5ef8e23f048e9259d4783d28d2407b5dL5

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, you are right!

The default location should be used here, but was deleted by accident.

I have updated the PR

@harikt harikt merged commit 5175adb into harikt:master Nov 17, 2016
@harikt
Copy link
Owner

harikt commented Nov 17, 2016

Thank you. And sorry for keeping this wait for long.

@harikt
Copy link
Owner

harikt commented Nov 17, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants