How to Install PHPSpreadsheet in Joomla - joomla

I'm wondering how to best incorporate PHPSpreadsheet into Joomla! applications, on shared hosting.
With PHPExcel, you just uploaded the library.
PHPSpreadsheet is using Composer, which is new to me, but looks straightforward enough. However, I see Joomla! includes it to manage dependencies in the core, but does not publish the composer.json file, and commits the /vendor subfolder.
Any advice on the best way to safely add PHPSpreadsheet so its available to Joomla! extensions, without messing up Joomla! core?

You can just add a normal composer.json file in Joomla's root folder. Composer will then create a vendor folder on the main level, and leave the libraries/vendor folder unchanged for the Joomla core.
Any extension that wants to use libraries from the root vendor folder must take care of loading the corresponding vendor/autoload.php by itself.

use
JLoader::registerNamespace('PhpOffice', $pathToPhpOffice);

Similar lines to the above.... But how do you get PHPSpreadsheet installed on my hosted website, where I have limited access to the back end.
I can FTP to the root of the site.

Related

Composer multiple projects?

I am trying composer on some projects and wondering... actually I have installed a CodeIgniter 4 by composer in my httpdocs/ folder.
Now I would like to install Flarum (forum) as well to have it referenced in my project (like domain.tld/forum links to flarum instance).
Questions is: How do I get both up and running in the same space? I don't want to use a subdomain for Flarum.
You cannot combine these projects into one composer project. Even if the dependencies wouldn't clash, they will at some point.
In your comments you mention installing flarum in a subfolder of the public_html, this is the best course of action. There's no need to be afraid of critical files becoming web accessible if you follow the path customizing instructions in the Flarum documentation: https://docs.flarum.org/install#customizing-paths
Disclaimer, I'm part of the Flarum team.

Should I add Backpack-installed Front-end Assets to Source Control?

I'm following the installation docs for Backpack 4.1 for Laravel. The backpack:install Artisan command adds front-end assets to the /public/packages directory of my project. Usually, front-end package managers (NPM, Yarn, Bower, etc.) recommend not to add the actual package contents to a project's repository, and instead add a dependency lockfile that can be re-installed by a CI/CD pipeline. Backpack does this differently, as it pulls the front-end dependencies directly and there was no mention if one needs to add /public/packages to source control. Should I add these package assets to source control, or should I execute php artisan backpack:install in the CI/CD process instead?
Yes - you should include the public/packages directory in your source control. That’s what Backpack assumes you’ll do.
However, if you would rather NOT do that, you can create an alias to the directory in the package. You can find instructions on how to do that here, as method 3 - https://backpackforlaravel.com/articles/tips-and-tricks/once-in-a-while-re-publish-backpack-s-css-and-js-assets
There are several reasons why you might want to do commit the public assets to the source control:
You may not have write access to your production file system.
You may be deploying to more than one server, and want to avoid duplication of work.
You may be doing frequent deploys that do not include asset changes.
Generally, I think it is a good idea to put precompiled assets into source control unless you have a specific reason not to do so.

Where Can I Directly Download Laravel Dependency Folders/Files from without using composer

For some reason, composer cannot work on my PC and wamp also (for now) so I downloaded the laravel zip folder, "laravel-master.zip".
I unzipped and uploaded this folder to my online production server but I noticed that I do not have the vendor folder. It was not included in the laravel-master folder.
So my question is... from where can I get the vendor folder (and any other folders/files) so I can manually add them to my laravel installation?
I will follow the same logic as the other saying. It is useless (and this is not recommended) to copy the vendor files because they are updated frequently and not stored.
the problem is that without composer, it will be difficult to work with Laravel (not only for class loading, but also unable to share your project later).
To use composer with WAMP, you probably forgot to specify during the installation, the php.exe WAMP to use. Located in C:\wamp\bin\php\phpx.y.z.
Here are two links that will help you achieve this. (You can uninstall your composer before to start from scratch)
Question and Answer about use composer in WAMP
Video about install composer and use it in WAMP
Then you just might be in the root of your project a composer update.

Updates to existing custom Joomla component

I am running Joomla 3.1.5. I have a custom component installed and I have made some minor changes to some of the files. How do I create an uploadable/installable zip file to install these changes to my production Joomla site?
Please disregard the discussion on templates in the comments above.
You don't need to rename your component it seems.
If you need to install on a single site:
on the prodution site, install the installer you first installed on
your development site
sync the files with a version control system
such as git / rsync / scp / sftp / ftp whichever you're most
comfortable with
If you need to install on multiple sites:
You need to repackage it, and add to the xml manifest any files/folders you added.
Simply explode the original zip installer somewhere on your drive, and figure out the folder structure (could be admin,site,media for example).
For each browse the custom_component_name.xml section and ensure it contains the files you added, if any.
Then copy the updated files over the folder structure, zip it, and upload it to production.
Once you do this the component will be registered in the other Joomla installation. You can also keep the copies aligned between the two servers with a code versioning system such as git.
If it's a component you plan on distributing, create a script to package it, look at the Joomla docs there's plenty of info, you could use a bash script, phing, ant, maven, choose one that suits you any will do the job

Export Joomla template and extensions

This is my first time building a Joomla template so I'm not quite sure if I'm doing it right.
I setup my joomla installation on my machine and added extensions to it - plus the customizations needed for the extensions and the template.
Once I install the template to a website, how do I include all the extensions with it (and the configuration of the extensions)? Or do I have to setup it all up all over again?
Thanks!
You have to set it up again. Extensions aren't part of the template. The Template defines the layout of the site, and the locations on the page where extensions can be added, but it doesn't include the extensions themselves.
There is an easy way. Rather than messing around with installing everything again, simply install Akeeba Backup. You really should have that installed anyhow. In any case, you can make a backup of the entire site including the database, then upload it to your host and run the built in install. It takes longer to upload the file than it does to make the backup and install it. When you are done you will have an exact copy of the site including extensions, templates, and configuration.

Resources