installation.rst 3.5 KB

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