Browse code

tweaked intro chapter

Fabien Potencier authored on 28/09/2013 08:50:34
Showing 1 changed files
... ...
@@ -46,26 +46,10 @@ Basic API Usage
46 46
 
47 47
 This section gives you a brief introduction to the PHP API for Twig.
48 48
 
49
-The first step to use Twig is to register its autoloader::
50
-
51
-    require_once '/path/to/lib/Twig/Autoloader.php';
52
-    Twig_Autoloader::register();
53
-
54
-Replace the ``/path/to/lib/`` path with the path you used for Twig
55
-installation.
56
-
57
-If you have installed Twig via Composer you can take advantage of Composer's
58
-autoload mechanism by replacing the previous snippet for::
49
+.. code-block:: php
59 50
 
60 51
     require_once '/path/to/vendor/autoload.php';
61 52
 
62
-.. note::
63
-
64
-    Twig follows the PEAR convention names for its classes, which means you
65
-    can easily integrate Twig classes loading in your own autoloader.
66
-
67
-.. code-block:: php
68
-
69 53
     $loader = new Twig_Loader_String();
70 54
     $twig = new Twig_Environment($loader);
71 55
 
... ...
@@ -86,3 +70,10 @@ filesystem loader::
86 70
     ));
87 71
 
88 72
     echo $twig->render('index.html', array('name' => 'Fabien'));
73
+
74
+.. tip::
75
+
76
+    If you are not using Composer, use the Twig built-in autoloader::
77
+
78
+        require_once '/path/to/lib/Twig/Autoloader.php';
79
+        Twig_Autoloader::register();