I need to know how to install php twig template and how to create a php sample using php twing template engine. I'm a beginner to twig..The documentation given in the twig site is confusing me.I need step by step instructions to install it Windows 10
Install Composer and run the following command to get the latest version:
composer require twig/twig
It will download twig. Then you can use
require_once '/path/to/lib/Twig/Autoloader.php';
Twig_Autoloader::register();
Related
I'm trying to install the Twig template engine. I downloaded the source and copied the lib/Twig folder inside my src/lib/Twig project folder. But there is no autoload.phpor Autoloader.php inside this folder so I can't simply run
require_once 'src/lib/Twig/autoload.php';
How can I install it ? Where do I find the autoload.php ?
Twig is supposed to be installed with composer, you can find the composer.json in the repository. That would also generate the neccessary loader.
If you really want to install it yourself, set up your psr-0 compatible autolader like the composer.json tells you. Also pay attention to the requirements block, install those too and set up their autoloading mechanism.
Composer really eases installing libraries with all their dependencies, I highly recommend getting familiar with it.
Am searching for PHP framework which supports PHP7 and latest php mongo driver (https://github.com/mongodb/mongo-php-driver) using 1.1.8 (https://pecl.php.net/package/mongodb)
I tried with codeignitor and fatfree but they seems to support old one. Any help is appreciated.
Thanks,
Zeeshan
If you are using codeignitor then you can install library through composer (you need to install composer first if you dont have)
Then go to your project directory through command line and run the following command
composer require "mongodb/mongodb=^1.0.0
It will install mongodb library in your vendor folder of your project.
Then you need to include following line where you want to use the library for eg you can include it on top of your controller or model.
require 'vendor/autoload.php';
What I want to do is use the elasticsearch php client in a typo3 extbase controller. Now I created a composer.json and did the composer install, now I have a vendor directory next to my typo3 directories.
But what do I do next? Can I somehow tell typo3 to use the autoload.php or is there another way to load the classes? I'm kinda helpless.
If you want composer support, then you should consider upgrading to TYPO3 7.6 LTS.
You can find some basic documentation about composer at the official website.
I am looking to implement the framework amphp/thread, with Symfony3, which I ve read about in this article (https://www.mullie.eu/parallel-processing-multi-tasking-php/).
I'd looked at the setting process on the git page: https://github.com/amphp/thread.
I've followed the checklist:
PHP5.5+ = OK Php 5.5.12
pecl/pthread = OK I did install it as explained on Windows8
Now, 3rd task on the checklist, I have the installation of the framework itself (amphp/thread) left to do.
I am a bit confuse, because it is not an "official" Symfony bundle. So I don't think I can put it under [my_symfony_project]/vendor/ and refer to it in the file [my_symfony_project]/app/AppKernel.php. So how do one do in this case:
Do one put the directory of the library under the root directory [my_symfony_project]?
And afterwards, how can one refer to it in the Symphony class/file, should I write: "use amphp/thread" between the namespace declaration of my Symfony file and the class code itself?
You can simply install the library with composer, as example launching this command from the root of your project:
>php composer.phar require amphp/thread
And use it in your code directly: the composer process generate the correct autoloader for you. No necessary add to the list of the Symfony2 bundle (is not a bundle).
Hope this help
You will need to install the package by adding the following to your composer.json file:
"require": {
"amphp/thread": "0.8.1"
}
Then run "composer install" on your server.
I have tested symfony and started with 2.0 now the new 2.0.1 version it out and I want to update. Is there an easy way to update the sources?
In Zend it is basically replacing the Zend folder with new libs. Maybe I can use an script like php bin/vendors install ?
Per the instructions on this post:
If you already have a project based on the Symfony Standard Edition
2.0.0, you can easily upgrade to 2.0.1 by getting the new deps and
deps.lock files.
Then, run the vendors script:
$ ./bin/vendors install
And don't forget to clear your cache:
$ php ./app/console cache:clear
Here are the files:
deps
deps.lock