I'm working on some project with file conversion docx to pdf
, and i use shared host server which dont have a ssh
connection, only option to use is Ftp
.
So is there any option to extract package as a library without using composer, like phpword
, its portable and can be basicly copied in server folder, but converter packages are only availabe with composer
.
I have tried to extract needed files from package, but seems they in core need autoloader.php and only option i see is just modifying source files for portable use.
Is there option how to do it easier, if thats posible?
I'm new with composer
which makes me hard to understand posibility of extraction packages for portable use.
Any suggestions? Thanks!
Yes, I ran into this 'composer' problem as well. Lots of developers seem to like it, for various reasons, but, if you want to try out a small package, or you only have FTP access, it just introduces another dependency. For big frameworks I can understand this, but for a small piece of code, with few classes, it makes no sense.
Example: I wanted to output an Excel file in ODS format, and found a relatively simple piece of code to do that:
https://github.com/Lapinator/odsPhpGenerator
Unfortunately the latest version depends on composer. No other way to use the code is provided. The developer probably sees this as an advantage? Well, I don't. So what to do? Be forced down the composer path, or hack the code a bit?
The latter can be a lot simpler than you might think. All we need is the content of the autoload.php file. This file will probably tell PHP where to find the classes of the package using SPL functions. You can try to write your own autoloader, but my package needs all its php files, so I simply wrote this:
require_once('../src/ods.php');
require_once('../src/odsDraw.php');
require_once('../src/odsFontFace.php');
require_once('../src/odsStyle.php');
require_once('../src/odsTable.php');
require_once('../src/odsTableCell.php');
require_once('../src/odsTableColumn.php');
require_once('../src/odsTableRow.php');
After adding that as the autoload.php to the package it worked without using composer.
In my opinion a developer should provide a way to try such a small package without having to go through the composer process. They probably don't do this because they want to do things 'the right way'. And, of course, once you're used to composer it is no big deal.