Using Composer Packages in XenForo 2.0 Addons Tutorial

Using Composer Packages in XenForo 2.0 Addons Tutorial 1.0.0

No permission to download

Sim

Well-known member
Sim submitted a new resource:

Using Composer Pacakages in XenForo 2 Addons Tutorial - How to use Composer packages in XenForo 2 addons

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

XenForo 2 uses Composer behind the scenes to include certain packages it uses - however, there is no way to automatically include your own packages for addons using this core Composer support. There is no composer.json file for XenForo 2 we can edit to add our own packages...

Read more about this resource...
 
I got the following error when building my addon:

  • ErrorException: [E_WARNING] unlink(): No such file or directory
  • src/XF/Util/File.php:614
  • Generated by: Unknown account
  • Jan 24, 2019 at 1:54 PM
Stack trace
#0 [internal function]: XF::handlePhpError(2, '[E_WARNING] unl...', '/home/eightway/...', 614, Array)
#1 src/XF/Util/File.php(614): unlink('')
#2 src/XF/Service/AddOn/ReleaseBuilder.php(439): XF\Util\File::deleteDirectory('/home/eightway/...')
#3 src/XF/Cli/Command/AddOn/BuildRelease.php(86): XF\Service\AddOn\ReleaseBuilder->finalizeRelease()
#4 src/vendor/symfony/console/Command/Command.php(255): XF\Cli\Command\AddOn\BuildRelease->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 src/vendor/symfony/console/Application.php(953): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 src/vendor/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(XF\Cli\Command\AddOn\BuildRelease), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 src/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 src/XF/Cli/Runner.php(63): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 cmd.php(15): XF\Cli\Runner->run()
#10 {main}
 
Code:
{
    "exec": [
        "composer install --working-dir=_build/upload/src/addons/EWR/Backup/ --no-dev --optimize-autoloader"
    ]
}
 
Are you running XF 2.0 or 2.1?

I haven't had a chance to try this on XF 2.1 yet to see whether things have changed.
 
Back
Top Bottom