How to Install and Use the Sylius Components ============================================ If you're starting a new project (or already have a project) that will use one or more components, the easiest way to integrate everything is with `Composer`_. Composer is smart enough to download the component(s) that you need and take care of autoloading so that you can begin using the libraries immediately. This article will take you through using :doc:`/components_and_bundles/components/Taxation/index`, though this applies to using any component. Using the Taxation Component ---------------------------- **1.** If you're creating a new project, create a new empty directory for it. .. code-block:: bash mkdir project/ cd project/ **2.** Open a terminal and use Composer to grab the library. .. tip:: |install_composer_link| if you don't have it already present on your system. Depending on how you install, you may end up with a ``composer.phar`` file in your directory. In that case, no worries! Just run ``php composer.phar require sylius/taxation``. .. |install_composer_link| raw:: html Install Composer .. code-block:: bash composer require sylius/taxation The name ``sylius/taxation`` is written at the top of the documentation for whatever component you want. **3.** Write your code! Once Composer has downloaded the component(s), all you need to do is include the ``vendor/autoload.php`` file that was generated by Composer. This file takes care of autoloading all of the libraries so that you can use them immediately. Open your favorite code editor and start coding: .. code-block:: php setAmount(0.23); $taxAmount = $calculator->calculate(100, $taxRate); echo $taxAmount; // Outputs "23". You can open the "script.php" file in browser or run it via console: .. code-block:: bash php script.php Using all of the Components --------------------------- If you want to use all of the Sylius Components, then instead of adding them one by one, you can include the ``sylius/sylius`` package: .. code-block:: bash composer require sylius/sylius Now what? --------- Check out :doc:`/components_and_bundles/components/general/what_is_resource`, which will give you basic understanding about how all Sylius components look and work like. Enjoy! .. _Composer: https://getcomposer.org