installation.rst 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. Installation
  2. ============
  3. Download bundles
  4. ----------------
  5. To begin, add the dependent bundles to the ``src/`` directory. If you are using
  6. git, you can add them as submodules::
  7. git submodule add git://github.com/sonata-project/SonatajQueryBundle.git vendor/bundles/Sonata/jQueryBundle
  8. git submodule add git://github.com/sonata-project/SonataBluePrintBundle.git vendor/bundles/Sonata/BluePrintBundle
  9. git submodule add git://github.com/sonata-project/SonataAdminBundle.git vendor/bundles/Sonata/AdminBundle
  10. git submodule add git://github.com/knplabs/KnpMenuBundle.git vendor/bundles/Knp/Bundle/MenuBundle
  11. If you are not using git, you will have to download them :
  12. - https://github.com/sonata-project/SonatajQueryBundle/archives/master
  13. - https://github.com/sonata-project/SonataBluePrintBundle/archives/master
  14. - https://github.com/sonata-project/SonataAdminBundle/archives/master
  15. - https://github.com/knplabs/KnpMenuBundle/archives/master
  16. Configuration
  17. -------------
  18. Next, be sure to enable the bundles in your autoload.php and AppKernel.php
  19. files:
  20. .. code-block:: php
  21. // app/autoload.php
  22. $loader->registerNamespaces(array(
  23. // ...
  24. 'Sonata' => __DIR__.'/../vendor/bundles',
  25. 'Knp' => __DIR__.'/../vendor/bundles',
  26. // ...
  27. ));
  28. // app/AppKernel.php
  29. public function registerBundles()
  30. {
  31. return array(
  32. // ...
  33. new Sonata\jQueryBundle\SonatajQueryBundle(),
  34. new Sonata\BluePrintBundle\SonataBluePrintBundle(),
  35. new Sonata\AdminBundle\SonataAdminBundle(),
  36. new Knp\Bundle\MenuBundle\KnpMenuBundle(),
  37. // ...
  38. );
  39. }
  40. The bundle also contains several routes. Import them by adding the following
  41. code to your application's routing file:
  42. .. code-block:: yaml
  43. # app/config/routing.yml
  44. admin:
  45. resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
  46. prefix: /admin
  47. _sonata_admin:
  48. resource: .
  49. type: sonata_admin
  50. prefix: /admin
  51. Now, install the assets from the different bundles:
  52. ``php app/console assets:install web --symlink``.
  53. At this point you can access to the dashboard with the url:
  54. ``http://yoursite.local/admin/dashboard``.
  55. .. note::
  56. If you're using XML or PHP to specify your application's configuration,
  57. the above configuration and routing will actually be placed in those
  58. files, with the correct format (i.e. XML or PHP).
  59. The last important step is security, please refer to the dedicated section.