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

Split classes into different files #13

Open
icc opened this issue Jan 14, 2016 · 5 comments
Open

Split classes into different files #13

icc opened this issue Jan 14, 2016 · 5 comments

Comments

@icc
Copy link
Member

icc commented Jan 14, 2016

To make the code easier to work with, we should put each class into separate file. We should also add or create some sort of default autoloader.

@falcon-git
Copy link
Member

Should probably follow PHP FIG when doing this?

@juho-jaakkola
Copy link
Contributor

I would suggest using composer for autoloading. It's in fact already doing it if the library is installed using composer: https://github.com/juho-jaakkola/h5p-php-library/blob/6773f7aad8f95d21c847e12e6ad781e1f8ff26b9/composer.json#L4-L8

Composer currently supports four different autoloading standards: https://getcomposer.org/doc/04-schema.md#autoload

@icc
Copy link
Member Author

icc commented Jan 14, 2016

I saw the autoloading in composer, but I'm not sure as to how it works. Will it generate a file that needs to be included in the plugin/module?

@juho-jaakkola
Copy link
Contributor

Yes. When you run composer install, it automatically creates vendor/autoload.php file, that you then include in the plugin script.

@davericher
Copy link
Contributor

I ended up just cutting them up and using Laravels IoC and a service provider to put them all together since 90% of the classes are singletons

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

No branches or pull requests

4 participants