Closed SouthRibbleTech closed 9 years ago
I have no error:
$ composer create-project kenjis/codeigniter-composer-installer codeigniter
Installing kenjis/codeigniter-composer-installer (v0.3.2)
- Installing kenjis/codeigniter-composer-installer (v0.3.2)
Loading from cache
Created project in codeigniter
Loading composer repositories with package information
Installing dependencies (including require-dev)
- Installing codeigniter/framework (3.0.3)
Downloading: 100%
Writing lock file
Generating autoload files
> Kenjis\CodeIgniter\Installer::postInstall
> composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing mikey179/vfsstream (v1.1.0)
Loading from cache
Writing lock file
Generating autoload files
> Kenjis\CodeIgniter\Installer::showMessage
==================================================
`public/.htaccess` was installed. If you don't need it, please remove it.
If you want to install translations for system messages or some third party libraries,
$ cd <codeigniter_project_folder>
$ php bin/install.php
Above command will show help message.
See <https://github.com/kenjis/codeigniter-composer-installer> for details
==================================================
$ cd codeigniter/
$ composer require kenjis/codeigniter-ss-twig:1.0.x@dev
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing twig/twig (v1.23.1)
Downloading: 100%
- Installing kenjis/codeigniter-ss-twig (dev-master a675f21)
Cloning a675f217a2f85a699681ab793ed862a1f7c90f34
Writing lock file
Generating autoload files
$ php vendor/kenjis/codeigniter-ss-twig/install.php
copied: application/libraries/Twig.php
$
I don't know why you have the error. Because install.php
just copies a file.
OK, I found the issue.
Composer created this path vendor/twig/twig/lib/Twig/Autoloader.php
So the code you said to only uncomment if NOT USING composer, I uncopied it and changed it to
require_once APPPATH . '../vendor/twig/twig/lib/Twig/Autoloader.php'; Twig_Autoloader::register();
Now it works OK
Can you give any advice how I can also get Twig to work with HMVC modules?
You can pass config to the Twig library. The default is the following:
$config = [
'paths' => [VIEWPATH],
];
You can add paths in module views to the array.
I had a similar issue. Maybe check to see if composer is being loaded into Codeigniter.
I fixed it by adding this line to my root Codeigniter index.php
include_once './vendor/autoload.php';
There are probably better ways to add composer but this worked for me.
私も同じ問題が発生しました。 私はconfig.phpの$config['composer_autoload'] にてautoload.phpのパスを指定することで問題が解決しました。
If you guys want to use Composer auto-loader, you must configure CI:
Additionally, if you want CodeIgniter to use a Composer auto-loader, just set $config['composer_autoload'] to TRUE or a custom path in application/config/config.php. https://www.codeigniter.com/userguide3/general/autoloader.html
Simply put this in "application/config/config.php"
$config['composer_autoload'] = 'vendor/autoload.php';
Hi,
Just installed this via composer then ran the install.php file.
I get the following error
Fatal error: Class 'Twig_Loader_Filesystem' not found in /var/www/html/procurement/application/libraries/Twig.php on line 63
I am running codeigniter 3.03 Apache2 PHP 5.5.9 Linux Mint 17
Any ideas what I have done wrong.