{"action":"created","issue":{"url":"https://api.github.com/repos/mtibben/html2text/issues/48","labels_url":"https://api.github.com/repos/mtibben/html2text/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/mtibben/html2text/issues/48/comments","events_url":"https://api.github.com/repos/mtibben/html2text/issues/48/events","html_url":"https://github.com/mtibben/html2text/pull/48","id":120520964,"number":48,"title":"Add a simple bootstrap file to decouple the test suite from Composer.","user":{"login":"orlitzky","id":1432135,"avatar_url":"https://avatars.githubusercontent.com/u/1432135?v=3","gravatar_id":"","url":"https://api.github.com/users/orlitzky","html_url":"https://github.com/orlitzky","followers_url":"https://api.github.com/users/orlitzky/followers","following_url":"https://api.github.com/users/orlitzky/following{/other_user}","gists_url":"https://api.github.com/users/orlitzky/gists{/gist_id}","starred_url":"https://api.github.com/users/orlitzky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orlitzky/subscriptions","organizations_url":"https://api.github.com/users/orlitzky/orgs","repos_url":"https://api.github.com/users/orlitzky/repos","events_url":"https://api.github.com/users/orlitzky/events{/privacy}","received_events_url":"https://api.github.com/users/orlitzky/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-12-05T02:02:59Z","updated_at":"2015-12-06T23:29:57Z","closed_at":"2015-12-06T22:53:36Z","pull_request":{"url":"https://api.github.com/repos/mtibben/html2text/pulls/48","html_url":"https://github.com/mtibben/html2text/pull/48","diff_url":"https://github.com/mtibben/html2text/pull/48.diff","patch_url":"https://github.com/mtibben/html2text/pull/48.patch"},"body":"The test case files all depend on PSR-4 autoloading, but no autoloader\r\nexists when the library is installed through (for example) a\r\ndistribution package manager. Fortunately the bootstrap process is\r\nsimple and this can be fixed with a single \"require\" statement.\r\n\r\nThis commit adds a new file, test/bootstrap.php, which loads the\r\nHtml2Text library. We then use this new file to bootstrap PHPUnit. The\r\nend result is that the test suite now works out-of-the-box without\r\nComposer. Running,\r\n\r\n  $ phpunit\r\n\r\nshould succeed from an unmodified tarball."},"comment":{"url":"https://api.github.com/repos/mtibben/html2text/issues/comments/162368553","html_url":"https://github.com/mtibben/html2text/pull/48#issuecomment-162368553","issue_url":"https://api.github.com/repos/mtibben/html2text/issues/48","id":162368553,"user":{"login":"orlitzky","id":1432135,"avatar_url":"https://avatars.githubusercontent.com/u/1432135?v=3","gravatar_id":"","url":"https://api.github.com/users/orlitzky","html_url":"https://github.com/orlitzky","followers_url":"https://api.github.com/users/orlitzky/followers","following_url":"https://api.github.com/users/orlitzky/following{/other_user}","gists_url":"https://api.github.com/users/orlitzky/gists{/gist_id}","starred_url":"https://api.github.com/users/orlitzky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orlitzky/subscriptions","organizations_url":"https://api.github.com/users/orlitzky/orgs","repos_url":"https://api.github.com/users/orlitzky/repos","events_url":"https://api.github.com/users/orlitzky/events{/privacy}","received_events_url":"https://api.github.com/users/orlitzky/received_events","type":"User","site_admin":false},"created_at":"2015-12-06T23:29:56Z","updated_at":"2015-12-06T23:29:56Z","body":"Thanks!\r\n\r\n> I wonder then if a generic PSR-4 autoloader can be a package dependency rather than relying on composer's - is that even possible?\r\n\r\nIt should be easy, but I'm not aware of one. PSR-4 specifies a naming convention that essentially lets you replace `\\\\` by `DIRECTORY_SEPARATOR` and then load the resulting path:\r\n\r\n> When loading a file that corresponds to a fully qualified class name ...\r\n>\r\n>    * A contiguous series of one or more leading namespace and sub-namespace names, not including the leading namespace separator, in the fully qualified class name (a \"namespace prefix\") corresponds to at least one \"base directory\".\r\n>\r\n>    * The contiguous sub-namespace names after the \"namespace prefix\" correspond to a subdirectory within a \"base directory\", in which the namespace separators represent directory separators. The subdirectory name MUST match the case of the sub-namespace names.\r\n>\r\n>    * The terminating class name corresponds to a file name ending in .php. The file name MUST match the case of the terminating class name.\r\n\r\nAlas, composer doesn't enforce those rules, so a lot of package authors violate them. For example, the paths may be in all lowercase while the namespaces are mixed-case. Or the filenames look like `Foo.class.php` instead of the required `Foo.php`. If everyone followed the rules, it would be trivial to write a PSR-4 autoloader that worked for everyone in about 10 lines of code. Very frustrating.\r\n\r\nThanks again!"}}