Hi all,
I’ve been using composer for a little while now when building little apps for smaller tasks.
But using Bedrock looked like a great way to include some extra functions we use into Wordpress.
Just checking, but did you run composer install after adding that? Bedrock requires composer’s autoload.php so as long as that’s been updated (which it does after install), then it should work. Can also try composer dump-autoload to be sure.
Thanks for the reply. Yes I ran update immediately after adding the require, but doesn’t seem to have done the trick. I’ve also tried composer dump-autoload
Feels like I’m missing the obvious.
I am adding this dependency in correctly by popping it into the end of the required array o.0?
composer install installs what’s in your composer.lock file. So when you add a new package and run install again, it won’t find it in the lock file yet. composer updatewill update the lock file and find new packages/versions.
Double checked with update this morning and still no luck. I’m guessing my problem may turn out to be environmental.
I tried removing the libraries and updating
`Loading composer repositories with package information
Updating dependencies (including require-dev)
Removing gilbitron/php-simplecache (1.4.1)
Removing hampel/json (dev-master 6af61ac)
Writing lock file
Generating autoload files
`
And re-adding them
`Loading composer repositories with package information
Updating dependencies (including require-dev)
Installing hampel/json (dev-master 6af61ac)
Loading from cache
Extracting archive
Installing gilbitron/php-simplecache (1.4.1)
Loading from cache
Extracting archive
Writing lock file
Generating autoload files`
But unfortunately the same simple $cache = new Gilbitron\Util\SimpleCache(); fails with the error Fatal error: Class 'Gilbitron\Util\SimpleCache' not found in /srv/users/serverpilot/apps/step/web/app/themes/step/lib/dataconnector.php on line 2
I’m pretty sure I’m doing it wrong but I just can’t put my finger on what. dataconnector.php was a new file I’d added to the includes in my roots theme. At present the only line it contains was $cache = new Gilbitron\Util\SimpleCache();
I’m not sure quite what it is but something in the hosting environment here is definitely causing problems. Serverpilot comes with composer pre-installed though.
For the moment I’ve moved the simplecache files directly into my theme.