vdf-parser icon indicating copy to clipboard operation
vdf-parser copied to clipboard

Add this package to composer

Open iNilo opened this issue 8 years ago • 6 comments

It would be nice to have this added to packagist.org

iNilo avatar Sep 13 '16 15:09 iNilo

Hi, I am not familiar with packagist.org

Can you give me an example of importing the library in some php code?

Thanks

rossengeorgiev avatar Sep 13 '16 16:09 rossengeorgiev

Usually PHP applications using Composer also use its autoloader. In this case the file vdf.php will be autoloaded. However this is polluting the global namespace (you can't do exports like JS) so I'd wrap it in a class.

Importing a library with composer is as simple as running:

composer require rossengeorgiev/vdf-parser

kbkk avatar Oct 12 '16 16:10 kbkk

From what I've looked briefly, there are namespaces and such, so this PR needs more work.

rossengeorgiev avatar Oct 12 '16 16:10 rossengeorgiev

Yeah, this would need to follow some PSR and have its own repository or at least branch so people don't download unnecessary files.

Here's an example of my PSR-4 package: https://github.com/kbkk/php-steam-auth/blob/master/composer.json

kbkk avatar Oct 12 '16 16:10 kbkk

Does it download all files? Can I put the php stuff in a separate directory?

rossengeorgiev avatar Oct 14 '16 12:10 rossengeorgiev

Seems like it will always download the whole repository branch/tag. So the best option would be to open another repository for the PHP version.

kbkk avatar Oct 14 '16 16:10 kbkk