mirror of
https://github.com/nikic/PHP-Parser.git
synced 2025-01-17 23:28:15 +01:00
Doc fixes
This commit is contained in:
parent
4cd2b95a23
commit
f56db26d8b
@ -6,22 +6,14 @@ There are multiple ways to include the PHP parser into your project:
|
|||||||
Installing via Composer
|
Installing via Composer
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
Create a `composer.json` file in your project root and use it to define your dependencies:
|
Run the following command inside your project:
|
||||||
|
|
||||||
{
|
php composer.phar require nikic/php-parser
|
||||||
"require": {
|
|
||||||
"nikic/php-parser": "~1.0.2"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Then install Composer in your project (or [download the composer.phar][1] directly):
|
If you haven't installed [Composer][1] yet, you can do so using:
|
||||||
|
|
||||||
curl -s http://getcomposer.org/installer | php
|
curl -s http://getcomposer.org/installer | php
|
||||||
|
|
||||||
And finally ask Composer to install the dependencies:
|
|
||||||
|
|
||||||
php composer.phar install
|
|
||||||
|
|
||||||
Installing as a Git Submodule
|
Installing as a Git Submodule
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
@ -35,5 +27,5 @@ Installing from the Zip- or Tarball
|
|||||||
Download the latest version from [the download page][2], unpack it and move the files somewhere into your project.
|
Download the latest version from [the download page][2], unpack it and move the files somewhere into your project.
|
||||||
|
|
||||||
|
|
||||||
[1]: http://getcomposer.org/composer.phar
|
[1]: https://getcomposer.org/
|
||||||
[2]: https://github.com/nikic/PHP-Parser/tags
|
[2]: https://github.com/nikic/PHP-Parser/tags
|
@ -6,7 +6,7 @@ This document explains how to use the parser, the pretty printer and the node tr
|
|||||||
Bootstrapping
|
Bootstrapping
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
The library needs to register a class autoloader. You can either use the ''vendor/autoload.php'' file generated by
|
The library needs to register a class autoloader. You can either use the `vendor/autoload.php` file generated by
|
||||||
Composer or by including the bundled `lib/bootstrap.php` file:
|
Composer or by including the bundled `lib/bootstrap.php` file:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
|
@ -67,7 +67,11 @@ class MyNodeVisitor extends PhpParser\NodeVisitorAbstract {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$lexer = new TokenOffsetLexer();
|
$lexer = new PhpParser\Lexer(array(
|
||||||
|
'usedAttributes' => array(
|
||||||
|
'comments', 'startLine', 'endLine', 'startTokenPos', 'endTokenPos'
|
||||||
|
)
|
||||||
|
));
|
||||||
$parser = new PhpParser\Parser($lexer);
|
$parser = new PhpParser\Parser($lexer);
|
||||||
|
|
||||||
$visitor = new MyNodeVisitor();
|
$visitor = new MyNodeVisitor();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user