Sylius Stack
  • Sylius Stack Documentation
  • Getting started
  • Cookbook
    • How to customize your admin panel
      • Basic operations
      • Customizing your grids
      • Customizing the logo
      • Customizing the menu
      • Configuring the security access
      • Customizing the page titles
    • How to use in a DDD architecture
      • Architecture overview
      • Resource configuration
      • Basic operations
      • Operation using a grid
  • Admin UI
    • Getting started
  • Bootstrap Admin UI
    • Getting started
  • Resource
    • Resource Bundle documentation
      • Installation
      • Create new resource
      • Configure your resource
      • Configure your operations
      • Validation
      • Redirect
      • Resource factories
      • Providers
      • Processors
      • Responders
      • Legacy Resource Documentation
        • Configuration
        • Services
        • Routing
        • Forms
        • Getting a Single Resource
        • Getting a Collection of Resources
        • Creating Resources
        • Updating Resources
        • Deleting Resources
        • Configuring a state machine
        • Configuration Reference
  • Grid
    • Grid Bundle documentation
      • Installation
      • Creating your first grid
      • Configuring Fields
      • Field types
      • Creating a custom Field Type
      • Creating a custom Action
      • Creating a custom Bulk Action
      • Filters
      • Creating a custom Filter
      • Advanced configuration
      • Configuration Reference
  • 🍀Twig Extra
    • Getting started
  • 🌱Twig Hooks
    • Getting started
    • Passing data to your hookables
    • Making your hookables configurable
    • Autoprefixing feature
    • Composable Layouts with a predictable structure
    • Advanced
      • Ergonomic work with hooks
      • Metadata objects
      • Multiple hooks inside a single template
      • Overriding hookables
Powered by GitBook
On this page
  1. Resource
  2. Resource Bundle documentation

Installation

PreviousResource Bundle documentationNextCreate new resource

Last updated 3 months ago

We assume you're familiar with , a dependency manager for PHP. Use the following command to add the bundle to your composer.json and download the package.

If you have .

composer require sylius/resource-bundle

Otherwise you have to download .phar file.

curl -sS https://getcomposer.org/installer | php
php composer.phar require sylius/resource-bundle

Adding Required Bundles to The Kernel

You need to enable the bundle and its dependencies in the kernel:

config/bundles.php
return [
    new FOS\RestBundle\FOSRestBundle(),
    new JMS\SerializerBundle\JMSSerializerBundle($this),
    new Sylius\Bundle\ResourceBundle\SyliusResourceBundle(),
    new BabDev\PagerfantaBundle\BabDevPagerfantaBundle(),
    new Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle(),
    new winzou\Bundle\StateMachineBundle\winzouStateMachineBundle(),
];

Configure your mapping paths for your resources

config/packages/sylius_resource.yaml
sylius_resource:
    mapping:
        paths:
            - '%kernel.project_dir%/src/Entity'

Configure the routing

config/routes.yaml
# [...]

sylius_crud_routes:
    resource: 'sylius.routing.loader.crud_routes_attributes'
    type: service

sylius_routes:
    resource: 'sylius.routing.loader.routes_attributes'
    type: service

That's it! Now you can configure your first resource.

Composer
Composer installed globally