@@ -293,6 +293,53 @@ flag::
293293 // Line
294294 // String
295295
296+ Syntax Validation
297+ ~~~~~~~~~~~~~~~~~
298+
299+ The syntax of YAML contents can be validated through the CLI using the
300+ :class: `Symfony\\ Component\\ Yaml\\ Command\\ LintCommand ` command.
301+
302+ First, install the Console component:
303+
304+ ..code-block ::bash
305+
306+ $ composer require symfony/console
307+
308+ Create a console application with ``lint:yaml `` as its only command::
309+
310+ ..code-block ::php
311+
312+ // lint.php
313+
314+ use Symfony\Component\Console\Application;
315+ use Symfony\Component\Yaml\Command\LintCommand;
316+
317+ (new Application('yaml/lint'))
318+ ->add(new LintCommand())
319+ ->getApplication()
320+ ->setDefaultCommand('lint:yaml', true)
321+ ->run();
322+
323+ Then, execute the script for validating contents:
324+
325+ ..code-block ::bash
326+
327+ # validates a single file
328+ $ php lint.php path/to/file.yml
329+
330+ # or all the files in a directory
331+ $ php lint.php path/to/directory
332+
333+ # or contents passed to STDIN
334+ $ cat path/to/file.yml| php lint.php
335+
336+ The result is written to STDOUT and uses a plain text format by default.
337+ Add the ``--format `` option to get the output in JSON format:
338+
339+ ..code-block ::bash
340+
341+ $ php lint.php path/to/file.yml --format json
342+
296343 Learn More
297344----------
298345