error with composer autoload installing phpspreadsheet - phpspreadsheet

I've never used composer before, so I'm not sure what this error means or what I need to do. But I am trying to use PHPSpreadsheet to be able to convert excel files into php for adding information to a database.
Uncaught Exception: Composer autoloader could not be found. Install
dependencies with composer install and try again.
Can anyone tell me what I need to do to get this system working.
Running cPanel with PHP7 EasyApache4
I do have root access to dedicated server.

Looks like you haven't installed the packages via composer.
You have to create a file named "composer.json" on the root of your project.
it should be something like this:
{
"require": {
"phpmailer/phpmailer":"5.2.22",
"slim/slim":"2.0",
"rain/raintpl":"3.0.0",
},
"autoload": {
"psr-4": {
"ProjectName\\": "vendor\\projectPackage\\php-classes\\src"
}
}
}
After that you should run the command "composer install" on you git bash and it will download your dependencies and create an autoload for you.

Related

Internal error when trying to use any composer functionality

I'm using composer in a ZF2 PHP project in Zend Studio 10.6. I recently tried to add a depency to the project, and I received an "internal error". Since then, whenever I try to use any function, I receive the same error:
Error msg
"An internal error occurred during: "Package Details".
For input string: "if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME""
The search function when I try to add a depency also does no longer find any packages, even though I have a repository installed.
I'm very grateful for any suggestions!
I had the same problem. My solution was to use the composer via the commander.
Make sure you have installed the composer (check by writing "composer -V" in your commander to see your version), then just place your dependency in your composer.json file.
For example:
"require" : {
"php" : ">=5.3.3",
"zendframework/zendframework" : "=2.3.7",
Run the command: "composer update" in your project.
For me this worked.
You can use all composer functions in the commander.
You can find help here if you use Ubuntu: How to install and Use Composer on Ubuntu
I know this is old, but it's a simple fix. This error basically means that ZS/Eclipse cannot find the composer.phar file. Ensure it is referenced properly in your system path, or within the IDE and 'Update Dependencies' will work just fine.

Install package into custom directory Composer

Hey I am trying to install a package into a custom 'admin' directory using composer.
Here is my JSON:
{
"name": "frontier/installer",
"description": "The best front end engineer package around",
"require": {
"aheinze/cockpit": "*"
},
"extra":{
"installer-paths":{
"admin": ["aheinze/cockpit"]
}
}
}
Now when I run composer install it all installs but defaults to vendor/aheinze/cockpit I cannot for the life of me figure out why.
Have done my research this should be the right code... any obvious errors?
Cheers.
I have implemented this composer plugin to install packages into user (custom) defined folders you can just include it in your composer.json, follow the example and tell me if you have more questions :)
https://github.com/mnsami/composer-custom-directory-installer
composer-custom-directory-installer
A composer plugin, to install differenty types of composer packages in custom directories outside the default composer default installation path which is in the vendor folder.
This is not another composer-installer library for supporting non-composer package types i.e. application .. etc. This is only to add the flexability of installing composer packages outside the vendor folder. This package only supports composer package types,
https://getcomposer.org/doc/04-schema.md#type
The type of the package. It defaults to library.
Package types are used for custom installation logic. If you have a package that needs some special logic, you can define a custom type. This could be a symfony-bundle, a wordpress-plugin or a typo3-module. These types will all be specific to certain projects, and they will need to provide an installer capable of installing packages of that type.
How to use
Include the composer plugin into your composer.json require section::
"require":{
"php": ">=5.3",
"mnsami/composer-custom-directory-installer": "1.1.*",
"monolog/monolog": "*"
}
In the extra section define the custom directory you want to the package to be installed in::
"extra":{
"installer-paths":{
"./monolog/": ["monolog/monolog"]
}
by adding the installer-paths part, you are telling composer to install the monolog package inside the monolog folder in your root directory.
As an added new feature, we have added more flexibility in defining your download directory same like the composer/installers, in other words you can use variables like {$vendor} and {$name} in your installer-path section:
"extra": {
"installer-paths": {
"./customlibs/{$vendor}/db/{$name}": ["doctrine/orm"]
}
}
the above will manage to install the doctrine/orm package in the root folder of your project, under customlibs.
Note
Composer type: project is not supported in this installer, as packages with type project only make sense to be used with application shells like symfony/framework-standard-edition, to be required by another package.
If you want to use the installer-paths option the package you want to be installed in a different path must require composer/installers.
In your case the aheinze/cockpit package doesn't require composer/installers as you can see in its composer.json at github.
Have a look at the composer documentation for custom paths and you see that it tells you:
Note: You cannot use this to change the path of any package. This is only applicable to packages that require composer/installers and use a custom type that it handles.
This means you are not able to change the install path of this specific package.
Anyway I don't see any necessity to install it into any different directory from the default vendor folder.
If you just need to put all packages under the "admin" directory, the best option is:
{
"config": {
"vendor-dir": "admin"
}
}
You can use the post-autoload-dump script to copy the package after install/dump-autoload:
"scripts": {
"post-autoload-dump": [
"cp -r vendor/aheinze/cockpit admin"
]
},
For install multiple packages in the same directory you can follow this structure
1- your path should be like this "modules/patched/{$name}"
2- and an array of any package that you want to move or install that same directory
"extra":{
"installer-paths": {
"modules/patched/{$name}": [
"drupal/signature_field",
"drupal/eck",
"drupal/auto_entitylabel"
]
}
The package or module should be in your require section as well.
"require": {
"composer/installers": "^1.0.24",
"drupal/auto_entitylabel": "2.x-dev",
"drupal/signature_field": "^1.0#RC",
"drupal/eck": "^1.0#alpha",
}

Bower install from URL gives blank folder

I'm using bower (v. 1.3.5) to pull in my Front-End JS dependencies, and I want to depend on this: https://github.com/dcneiner/Downloadify
It doesn't have its own bower.json so I'm referencing by URL in MY bower.json:
"dependencies": {
"jspdf": "~1.0.272",
"downloadify": "https://github.com/dcneiner/Downloadify.git"
}
But all I get is the named folder containing only a .bower.json file, but none of the code or anything else in the GH repo.
Running bower install directly on the cmd line gave (once I'd cleared out the bower cache):
E:/My/Path>bower install https://github.com/dcneiner/Downloadify.git
bower Downloadify#* not-cached https://github.com/dcneiner/Downloadify.git#*
bower Downloadify#* resolve https://github.com/dcneiner/Downloadify.git#*
bower Downloadify#* checkout 0.2.1
bower Downloadify#* resolved https://github.com/dcneiner/Downloadify.git#0.2.1
bower Downloadify#~0.2.1 install Downloadify#0.2.1
I previously did the same thing with jQuery.fileDownload which worked perfectly, so I don't think it's anything I've done to my machine?
QUESTION:
Have I done something wrong?
Has Downloadify been set up wrong?
Or is it an inexplicable mystery?
In either of the first 2 cases, what is the problem and how do I fix it?
NOTE: Currently I'm working around it by having downloaded the source code manually and having it hard-coded into my project.

Bower install CERT_UNTRUSTED Error

I got the CERT_UNTRUSTED when I tried to run bower install command to install components.
For example, I got this error when I ran the following:
bower install bootstrap-sass-official --save
The output was:
bower error Request to https://bower.herokuapp.com/packages/bootstrap-sass-official failed: CERT_UNTRUSTED
Note: This is not a package specific error. This happens when you try to install any package, not just with bootstrap-sass-official.
you can try setting this in .bowerrc:
{
"directory": "bower_components",
"registry": "http://bower.herokuapp.com",
"strict-ssl": false
}
I found a quick fix for this issue. I guess the issue is happening because of my company's SSL settings.
I changed the registry search as follows (in my windows laptop) and it fixed the issue.
set registry.search=http://bower.herokuapp.com
This should work in unix systems as well, where you have to create a env variable with above key and value.
You can also change the registry setting at .bowerrc file.
You can follow as a quick and dirty fix. Do not make it as a permanent solution.

Choose bower install directory

This is a follow-up to this question. I'm using bower 0.7.1, and still cannot get the components to be installed anywhere else than in the components folder.
I tried adding the following line to my component.json, as per this PR:
"componentsDirectory": "public/components"
But it will still install in ./components.
I tried to create a .bowerrc file next to component.json:
{
"directory" : "public/components"
}
But I get this error when running bower install:
Error: Unable to parse local .bowerrc file: Unexpected token }
Any idea?
Actually the .bowerrc file does work, this was an issue with my IDE not saving the file properly:
{
"directory" : "public/components"
}
I'm still wondering why componentsDirectory still doesn't work in component.json, though.
While you can happily use Bower to manage the dependencies of your own personal projects, primarily the component.json is a description of your project for other people. If you share a component through the Bower registry the component.json goes with it to describe the dependencies. That is why your own local preferences like where to install components don't belong in there.
Another way to change installation directory temporarily is using --config option in command line:
bower install jquery --config.directory=/path/to/your/components
If you are creating this file in Notepad++, make sure the Encoding is set to "Encode in UTF-8 without BOM" and save as file type "Any".

Resources