installation.rst 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. and run::
  23. bin/vendors install
  24. If you are using git, you can add them as submodules::
  25. git submodule add git://github.com/sonata-project/SonatajQueryBundle.git vendor/bundles/Sonata/jQueryBundle
  26. git submodule add git://github.com/sonata-project/SonataBluePrintBundle.git vendor/bundles/Sonata/BluePrintBundle
  27. git submodule add git://github.com/sonata-project/SonataAdminBundle.git vendor/bundles/Sonata/AdminBundle
  28. git submodule add git://github.com/knplabs/KnpMenuBundle.git vendor/bundles/Knp/Bundle/MenuBundle
  29. If you are not using git, you will have to download them :
  30. - https://github.com/sonata-project/SonatajQueryBundle/archives/master
  31. - https://github.com/sonata-project/SonataBluePrintBundle/archives/master
  32. - https://github.com/sonata-project/SonataAdminBundle/archives/master
  33. - https://github.com/knplabs/KnpMenuBundle/archives/master
  34. Configuration
  35. -------------
  36. Next, be sure to enable the bundles in your autoload.php and AppKernel.php
  37. files:
  38. .. code-block:: php
  39. // app/autoload.php
  40. $loader->registerNamespaces(array(
  41. // ...
  42. 'Sonata' => __DIR__.'/../vendor/bundles',
  43. 'Knp' => __DIR__.'/../vendor/bundles',
  44. // ...
  45. ));
  46. // app/AppKernel.php
  47. public function registerBundles()
  48. {
  49. return array(
  50. // ...
  51. new Sonata\jQueryBundle\SonatajQueryBundle(),
  52. new Sonata\BluePrintBundle\SonataBluePrintBundle(),
  53. new Sonata\AdminBundle\SonataAdminBundle(),
  54. new Knp\Bundle\MenuBundle\KnpMenuBundle(),
  55. // ...
  56. );
  57. }
  58. The bundle also contains several routes. Import them by adding the following
  59. code to your application's routing file:
  60. .. code-block:: yaml
  61. # app/config/routing.yml
  62. admin:
  63. resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
  64. prefix: /admin
  65. _sonata_admin:
  66. resource: .
  67. type: sonata_admin
  68. prefix: /admin
  69. Now, install the assets from the different bundles:
  70. ``php app/console assets:install web --symlink``.
  71. At this point you can access to the dashboard with the url:
  72. ``http://yoursite.local/admin/dashboard``.
  73. .. note::
  74. If you're using XML or PHP to specify your application's configuration,
  75. the above configuration and routing will actually be placed in those
  76. files, with the correct format (i.e. XML or PHP).
  77. The last important step is security, please refer to the dedicated section.