A question concerning Joomla, Libraries and Composer.
I've developed a library locally using namespaces and composer autoload. My plugin then uses that library and everything works locally as I executed composer install inside the library.
Now my question is: How can I execute that composer install inside the library when installing the extension on a Joomla! site? (And at the same time: how to composer update on library update?)
Thanks for your help :)
[Fatal error: require_once(): Failed opening required '/.../joomla/libraries/vendorname/libraryname/vendor/autoload.php']
As per Joomla docs; Using Composer with Joomla, they do not yet support for additional libraries.
Can you install any extra libraries via Composer?
Not at the moment in Joomla! 3.4. In the longer term it is the CMS's aim that you
can download extra packages. To emphasize this, we will not yet be
releasing the composer.json file within the main Joomla! download.
What I can suggest you keep that package in a folder and require that autoloader file where you need it.
Related
Is it possible to install B2B Suite in Shopware 6 with Composer?
My approach so far has been
composer require shopware/b2b
php bin/console plugin:install SwagB2bPlatform
But this leads to an error when I try to install the plugin
The class "SwagB2bPlatform\SwagB2bPlatform" is not found. Probably an class loader error. Check your plugin composer.json
Does anyone have any experience with this? Do I have to run any scripts to make sure the plugin has all the necessary resources?
Shopware has no way to simple way to require proprietary plugins. You should not use SwagB2bPlatform as composer repository via vcs as all needed assets get packed before the release.
You can setup packages.friendsofshopware.com for your projects. This is a community driven project which provides a repository of all plugins in the community story. You are limited to plugins that you bought in the community store. Using this repository needs an extra entry in the repositories in your composer.json. After that you can just require any plugin that is assigned to your project. In the search you can find the plugin you look out for: https://packages.friendsofshopware.com/?producers=shopware%20AG&term=b2b
I recently started learning UserFrosting...
I managed to successfully install highlightjs from Packagist using Composer. All went well, new folder and all required files are created in /userfrosting/vendor/components/highlightjs
However, initialize.php and it's includeJSTop() does inject the reference in a path pointing to /public_html/js while files are in /userfrosting/vendor/components/highlightjs
There is a simple solution - to copy highlightjs.js from /userfrosting/vendor/components/highlightjs to /public_html/js but I would like to know if my approach is correct. Or perhaps there is a better way where files are copied to /public_html/js as a part of Composer's install/update.
Composer is for PHP packages. highlight.js is a Javascript package, so it doesn't really make sense to load it using Composer.
There are package managers for Javascript - NPM being the most popular - but UserFrosting 0.3.1 doesn't use those out of the box (UF4 will have integrations for NPM, but that hasn't been released as of the time of this post).
Your best bet for now would indeed be to simply do a "manual install" and copy the highlight.js file to your public/js directory. In that case, you don't need to load it with Composer.
I'm wondering how I would be able to load PHP packages without using composer to do so.
I'm unable to use composer as I'm using shared hosting, which imposes limitations like being unable to install composer due to a heavily jailed shell.
While there are certain packages which allow for the loading of a package with require_once('package/Autoloader.php');, i.e. Braintree & Twig.
However, not all packages can be loaded like this, example being,
Pug-PHP, which only includes installation with composer.
Can anyone help me load composer packages without composer?
This is not possible due to Packages being a dependency of the composer management system. Replicate the ENV locally and use #MichalGallovic 's suggestion.
There is also the option of git clone every package and dependency from their respective source repos; but at that point you will hate yourself.
Is the option of using a host that are not as strict an option?
Visit https://php-download.com/ They have a number of packages ready to go that will no longer need Composer. It finds and creates all required folders and creates a zips it for download. Saves me hours of drama.
I have tried to install both ZendPdf and TCPDF into ZF2 using Composer without success.
Software is installed and autoload files are written but nothing works, ZF can't see them.
Which files do I need to edit in order to manually install TCPDF library so that it autoloads?
I have found lots of similar questions in StackOverflow but not many working answers that don't involve Composer.
In fact, you don't install them without Composer. I think it is easier to make Composer work than to install them by hand.
In theory you could install them by hand. Just download both components in a version you like. Then look into their composer.json file if you need to download some more software these libs need. Download them as well. Have a look in their composer.json to download even more software.
After these downloads, unpack the packages, create a whole directory tree of files, and create the autoloading manually. Which means again you have to look at all the composer.json files for the definition of autoloading. You are lucky if you find PSR-0 or PSR-4 autoloading, and you have to manually scan EVERY file in the directory if you have classmap autoloading.
You then simply push all these definitions into your own autoloader and hope it works.
Done. That was easy... NOT!
I can help you get Composer to work, but I cannot help you NOT use Composer. Ask a new question describing your problem using Composer.
Please follow these instruction below to install Zend without composer. But I recommend to use composer for future consistency
Download latest stable copy of ZF2 from http://framework.zend.com/downloads/latest and unpack, we call it "ZF2"
Download latest stable copy of ZF2 skeleton app from https://github.com/zendframework/ZendSkeletonApplication/ and unpack, we call it ZF2Skeleton
Create folder like /vendor/ZF2
Now copy ZF2/* into /vendor/ZF2
Now you need to fix ZF2_PATH or $zf2Path variable at “/init_autoloader.php” file of root to point our “/vendor/ZF2” folder. Find "$zf2Path = false;" line into "/init_autoloader.php" file and replace it by "$zf2Path = 'vendor/ZF2/library';"
That's all. You may visit https://shkhan.wordpress.com/2014/04/26/install-zend-framework-2-into-windows-iis/ for more information about installing ZF2 without composer.
I have created component for Joomla 2.5.11. And now I have to use composer during installation my component. I am using AWS libraries, that is why I need to upload AWS PHP libraries to target Joomla Web Site. How can I do it?
I guess to execute autoloader for downloading libraries.
You can move on the directory where the composer.json of aws-sdk is and run composer install.