installation.rst 2.3 KB

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