Cakephp loading Plugins installed with composer - cakephp-3.2

I installed friendsofcake/crud plugin with composer require friendsofcake/crud. composer installed it in vendor directory called friendsofcake.
Now i want to load the plugin into my app.doing something like this does work
cake plugin load friendsofcake
I get error `Exception: Plugin friendofcake/crud is could not be found> Is there something I should know about loading composer loaded plugins.

Related

Cant Install Commerce Checkout Module

I'm in the process of upgrading my website from Drupal 7 to 8 and one of my tasks is to ensure that all modules are copied over and installed.
I've been able to install every 'Commerce' module apart from the checkout.
Unable to install Commerce Checkout due to unmet dependencies:
core.entity_view_display.commerce_product_variation.default.summary
(commerce_product.commerce_product_variation_type.default)
This question was asked and answered here: Can't install drupal 8 commerce checkout module
However, it does not help me because I've already used Composer to install the commerce module but I still cant enable it.
$ composer require drupal/commerce
Using version ^2.5 for drupal/commerce
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
> Drupal\Core\Composer\Composer::preAutoloadDump
> Drupal\Core\Composer\Composer::ensureHtaccess
$ composer require drupal/commerce_checkout
Using version ^2.5 for drupal/commerce_checkout
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
> Drupal\Core\Composer\Composer::preAutoloadDump
> Drupal\Core\Composer\Composer::ensureHtaccess
$ composer require drupal/commerce_product
Using version ^2.5 for drupal/commerce_product
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
> Drupal\Core\Composer\Composer::preAutoloadDump
> Drupal\Core\Composer\Composer::ensureHtaccess
I appreciate any solutions that you may have and look forward to discussing this issue with you further.
Thanks!
I guess you already fixed the issue yourself simply by "installing" drupal/commerce first.
The three snippets you provided at the end of your question look fine and actually just says they are already "installed". Composer downloaded everything for you and now you just have to enable them via drush or from the UI.
Now I got it. This error message occurs when installing Commerce Checkout via drush/drupal console (or maybe even via the UI). And it says it requires a display or view mode from the Commerce Product entity type. Then I guess the second answer in the linked question is right: install Commerce Product first as that may provide the missing display upon installation.
Even if that doesn't work you may circumvent the issue by creating the display or view mode manually yourself.

Wordpress roots/sage installation options not working

I have install sage on my wordpress, but there no choice for selecting options that sage docs says
During theme installation you will have the options to:
Update theme headers (theme name, description, author, etc.)
Select a CSS framework (Bootstrap, Foundation, Tachyons, none)
Add Font Awesome
Configure Browsersync (path to theme, local development URL)
C:\php7\htdocs\blog\wp-content\themes>composer create-project roots/sage foundat
ion 8.5.3
Installing roots/sage (8.5.3)
- Installing roots/sage (8.5.3): Loading from cache
Created project in foundation
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing composer/installers (v1.4.0): Loading from cache
Writing lock file
Generating autoload files
I success activate the foundation theme on wordpress dashboard. Is I miss something?
After installing sage 9 there is still no choice for selecting options because TTY mode is not supported on Windows platforms.
To work around it, run these commands from within your theme directory:
./vendor/bin/sage meta
./vendor/bin/sage config
./vendor/bin/sage preset
You are reading the docs for sage 9.x but installing 8.5.3 which is a complete different setup and doesnt have the features mentioned above. Sage 9 can only be installed when running PHP 7.x and up.
If you just use the same composer command without the version number you shouls get the latest version.

Wordpress: Unable to install plugins from wp-cli

Hi I am using a Ubuntu system. I am using a shell script to download wordpress from wget, update config and run it from nginx server.
Now I want to update this shell script so that when we install a fresh copy of WordPress, I get some plugins pre-installed.
So I installed wp-cli and ran the command
wp plugin install w3-total-cache --activate --allow-root
This command says the plugin has been activated successfully. But when I go to the site URL in the plugins section, it gives the following error
The plugin w3-total-cache/w3-total-cache.php has been deactivated due to an error: Plugin file does not exist.
This is true for any plugin that I try to install.
When I go to the plugins folder inside wp-content, I can see that plugin files exist. But still I get the error.
How to resolve this. Please help
You should try uploading the plugin by logging in to your wp-adm
Are you using the latest version of wp-cli?
Try: wp cli check-update

How to instal modules with Drupal 8 and Composer?

I installed Drupal 8 via composer with:
composer create-project drupal-composer/drupal-project:8.x-dev my_site --stability dev --no-interaction
This downloaded all the files and run composer install. According to this tutorial - https://www.drupal.org/node/2718229 - doing so this way will also configure composer.json to allow installation of modules, themes etc too via composer. Nice
However, I'm trying to install a new module:
$ composer require drupal/codesnippet
Using version ^1.6 for drupal/codesnippet
./composer.json has been updated
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing drupal/codesnippet (1.6.0)
Downloading: 100%
Writing lock file
Generating autoload files
> DrupalProject\composer\ScriptHandler::createRequiredFiles
However, when I go to Admin Bar > Extend > Install new module, I can search for the module and it says it's not installed yet. If I try to enable/install it from there it tells me I need to download and copy to the /libraries directory:
Before you can use the CKEditor CodeSnippet module, you need to download the codesnippet plugin from ckeditor.com and place it in /libraries/codesnippet. Check the README.txt for more information. Get the plugin here. (Currently using CodeSnippet version Plugin not detected)
Are these two completely different methods? How can I complete the installation with composer of this module?
Composer is a dependency manager, and whether or not third-party dependencies are included depends on how the module author managed their dependencies in the first place.
You aren't going to be able to complete the install via Composer alone, if a specific dependency isn't present on the repository that Composer downloads its packages from.
You're going to have to download the CKEditor CodeSnippet module from ckeditor.com. Composer can't manage that dependency for you, because that CKEditor plugin isn't a Composer package.
You can download it here: http://ckeditor.com/addon/codesnippet
Martyn, I guess you are confusing two different things into the same one: the drupal module and the external library required by the module.
The Drupal module codesnippet (https://www.drupal.org/project/codesnippet) is just a drupal integration module for the CKeditor addon with the same name, which you can download it (http://download.ckeditor.com/codesnippet/releases/codesnippet_4.6.2.zip) and place it in the drupal webroot /libraries folder manually (in your case my_site/web/libraries/ to be more specific - you have to create it if does not exist already).
Then you should be able to enable the drupal module.
PS: You could also add the library requirement in the composer.json library manually, which might be just a bit more complicated for beginners, because you also have to manually specify other things like a repository type, url and installer-paths for the extra external library that you need , but might be easier in the long run to deploy new Drupal8 installations with the same requirements just with a proper main composer.json file, without the need to go and manually download external libraries. There is a similar comment of mine(user zet) that you could read on this drupal dropzonejs module issue https://www.drupal.org/node/2853274

Use composer ton install depedencies while creating custom WP plugin

I'm really new to composer and don't understand it well (yet).
Here's the thing :
I'm building a Wordpress plugin that needs external libraries.
Thoses libraries are FluentDOM and Selectors-Symfony for FluentDOM.
Both have installation instructions for Composer only :
FluentDOM :
FluentDOM is available on Packagist.org, just add the dependency to your composer.json.
{
"require" : {
"fluentdom/fluentdom": "5.x"
}
}
Selectors-Symfony :
composer require symfony/css-selector
My plugin path is /wordpress/wp-content/my-custom-plugin.
Should I write a composer.json file at the root of this directory, and what should be its content ?
Eventually, I would like install those depedencies in /wordpress/wp-content/my-custom-plugin/_inc/lib
Could anyone explain me how to do this ?
Thanks !
Well, I'd say that unless Wordpress starts supporting Composer (they don't officially at this time although Wordpress can be installed with Composer if you know what you're doing, first and foremost know the package name of it), you shouldn't think too much about using it for delivery of your plugin, meaning: If you use other software in your plugin, I think you have to bundle it inside your plugin, or it won't work.
It still will create issues like "Is the version of the library you are using compatible with the same library other plugins use?" and "How do you do autoloading?" correctly.
Internally, you could use Composer to manage these libraries just like you would do with any other project that uses Composer, with the minor difference that the released package of your plugin must include all these libraries and autoloaders you added - with Composer or something else.
Be warned that I basically don't know anything about how Wordpress people usually organize their stuff. Reading the discussion I linked to in the comment to your question, I get the impression that they have still a very long way to go, and that there is nobody actively behind it and promotes using Composer for dependency management because it also works the usual way, or it might break things.
Internally, you could use Composer to manage these libraries just like
you would do with any other project that uses Composer, with the minor
difference that the released package of your plugin must include all
these libraries and autoloaders you added - with Composer or something
else.
Thanks Sven, that is what I wanted to know.
I finally managed to do it.
Here is my step-by-step guide to install a dependency (here, fluentDOM) into /wordpress/wp-content/plugins/my-custom-plugin/_inc/php with the terminal and without having any composer.json at the start.
First, of course, you need to install Composer. As I will use it for php dependencies of my plugin, I will install it in my-custom-plugin/_inc/php.
(You could also install it at the root of your plugin and adjust following commands)
1/ Open Terminal and go to that directory :
cd /Applications/MAMP/htdocs/my-project/wordpress/wp-content/plugins/my-custom-plugin/_inc/php
2/ Install Composer :
curl -sS https://getcomposer.org/installer | php
Now I'm ready to use Composer in my-custom-plugin/_inc/php.
On the fluentDOM website, I see that the package I need to install is called fluentdom/fluentdom.
3/ So, let's install the package :
composer require fluentdom/fluentdom
If you need more informations about this package, the website packagist could be useful. It shows informations (version, dependencies), ... for composer packages. See fluentdom/fluentdom.
This installs fluentdom in the default composer directory /vendor and generates a composer.json file; which is nice to update dependencies later.
Here's the generated content:
{
"require": {
"fluentdom/fluentdom": "~5.2"
}
}
But we wanted our dependency to be installed into my-custom-plugin/_inc/php, not into my-custom-plugin/_inc/php/vendor !
4/ Let's edit composer.json, and set the default directory parameter vendor-dir to empty.
{
"require": {
"fluentdom/fluentdom": "~5.2"
},
"config": {
"vendor-dir": ""
}
}
5/ Delete the my-custom-plugin/_inc/php/vendor directory as we don't need it anymore.
6/ Now that we have a composer.json file, we just have to run
composer.phar install
Or
composer.phar update
... and the magic happens ! Done !!! We have the dependencies installed, and an autoload.php file generated.
7/ The last thing to do is to include the autoload.php in your plugin :
require_once( plugin_dir_path( __FILE__ ) . '_inc/php/autoload.php' );
This was the way to achieve it without having a composer.json file.
If you have your composer.json file ready, skip steps 3 to 5.
I also suggest to read this blog post : 5 features to know about Composer PHP.

Resources