8K Views

How to Create UVdesk Open Source Extension Framework Package?

Updated 19 November 2024

Facebook Linkedin

Introduction

In this blog, I am going to explain How to create a new UVdesk extension framework package from scratch. First, you need to understand the following:

    • Package: An abstract entity similar to a programming language class or a software project
    • Application: The concrete form of a Package similar to an object of class or software product.

STEP 1:

  • Browse to the apps directory present in your project’s root directory
  • Create a new directory structure uvdesk/package-name inside the apps directory
  • Browse to the package-name directory

STEP 2:

  • Inside package-name directory create src and templates directory
  • Create a new file extension.json which holds package metadata like name, author, autoload, etc.

STEP 3:

  • Inside the templates, directory put the appropriate configuration files like template files for parsing your application configuration

STEP 4:

  1. Inside the src directory create the following directories
  2. The resources directory contains the following directories:
    • CSS for CSS stylesheets
    • js for javascript files
    • images for image files
    • config directory contains services.yaml for configuring your package’s services with the extension framework
    • you can also put a directory for routes inside the config directory that may hold your package’s routing configuration files.
  1. DependencyInjection for holding package data template i.e. structure and type of data your package is going to handle.
  2. The routing directory contains metadata class files that tell where to look for your package’s routes
  3. Apps directory for holding your package application metadata like name, app icon,

STEP 5:

  • Extend/Implements the following classes/Interfaces:
    •  Application (Webkul\UVDesk\ExtensionFrameworkBundle\Definition\Application) representing the application you are creating. For more info consult uvdesk extension-framework
    • ApplicationMetadata (Webkul\UVDesk\ExtensionFrameworkBundle\Definition\Application\ApplicationMetadata) which will holds metadata information about your package application.
    • ProtectedRoutingResourceInterface (Webkul\UVDesk\ExtensionFrameworkBundle\Definition\Routing\ProtectedRoutingResourceInterface) tells the extension framework where to look for your package’s private routes
    • ExposedRoutingResourceInterface (Webkul\UVDesk\ExtensionFrameworkBundle\Definition\Routing\ExposedRoutingResourceInterface) tells the extension framework where to look for your package’s public routes

STEP 6:

  • Now you need to tell the extension framework whether your package is configurable or not.
  • Create a new class inside the src directory with the following name PackageNamePackage

Simple Package:

  • Make it extend/implement the following:
    •  Package (Webkul\UVDesk\ExtensionFrameworkBundle\Definition\Package\Package)
       PackageInterface (Webkul\UVDesk\ExtensionFrameworkBundle\Definition\Package\PackageInterface)
    • For more info consult uvdesk extension-framework

Configurable Package:

  • Make it extend/implement the following
    •  ConfigurablePackage (Webkul\UVDesk\ExtensionFrameworkBundle\Definition\Package\ConfigurablePackage)
       ConfigurablePackageInterface (Webkul\UVDesk\ExtensionFrameworkBundle\Definition\Package\ConfigurablePackageInterface)
    • You also need to create a PackageConfiguration class that will live inside the DependenyInjection namespace of your package
    • The PackageConfiguration class needs to implments symfony’s ConfigurationInterface (Symfony\Component\Config\Definition\ConfigurationInterface).
    • This class will contain a single method called getConfigTreeBuilder() which will return an instance of Symfony’s TreeBuilder  (Symfony\Component\Config\Definition\Builder\TreeBuilder) representing your package data template.
    • For more info consult uvdesk extension-framework
Category(s) Symfony UVdesk
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.