Closed mbomb007 closed 2 years ago
It would also be awesome if you would add a composer.json file.
This isn't a project in the normal sense, it's a collection of a bunch of loosely-related (I wrote them) pieces. The code is in multiple languages and is not suitable as a dependency for anything. There's not anything to tag as a release.
For anyone wanting to actually use your PHP code in a Composer-managed codebase, it needs to be useable as a dependency.
So what I have to do right now is this:
"repositories": [
{
"type": "package",
"package": {
"name": "jamesjonesmath/canvancement",
"version": "dev-master",
"dist": {
"url": "https://github.com/jamesjonesmath/canvancement/archive/refs/heads/master.zip",
"type": "zip"
},
"source": {
"url": "https://github.com/jamesjonesmath/canvancement",
"type": "git",
"reference": "master"
}
}
}
],
"require": {
"php": "^8",
"ext-curl": "^8",
"jamesjonesmath/canvancement": "dev-master"
},
Certainly, I may only be using a piece of your codebase, but it's still a project with a repository that can be a dependency for someone's code to work.
Anyways, hopefully anyone else needing to do this would find the above Composer code helpful.
Creating a composer.json file like that is a very bad idea. There are only 3 PHP files that I can find, none of which is being actively maintained and I'm pretty sure there are bugs in the one to create the MySQL scripts for Canvas Data.
But the real reason is that this is not a PHP codebase. There is a very limited amount of PHP in there, but it's just a lot of hodge-podge stuff I do. Including it in composer is going to bring in a lot of extra crap that you don't need (98% crap for 2% useful code). You should not be making that a dependency for anyone else. It would be much better for you to make your own fork of just the one or two files that you think you want and then use that.
When I set this up, I didn't (still don't) know how to use GitHub. I don't have the time to refactor everything into separate programs and there are too many links to the code where it is.
Yeah, I realized I'm using such a small part and it's probably easier for me to maintain my project and its PHP version compatibility going forward if I just implement what I want to do myself. Still, it was nice to have a working example of connecting to the API.
I also was only using api.php. I wouldn't use SQL like the MySQL scripts if at all possible. Dynamic SQL like that sounds like a very bad idea -- prone to security vulnerabilities and SQL injection attacks.
Can you tag an official release, so that it's easier to see versioning and use this project as a dependency?