2K Views

How to create a new UVDesk Opensource Extension Framework Package by yourself?

Introuduction

  • 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: Concrete form of 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.
// extension.json
{

    "name": "uvdesk/package-name",

    "description": "Description",

    "type": "uvdesk-module",

    "authors": [

        {

            "name": "name",

            "email": "examle@xxx.com"

        }

    ],

    "autoload": {

        "UVDesk\\CommunityPackages\\VendorName\\PackageName\\": "src/"

    },

    "package": {

        "UVDesk\\CommunityPackages\\VendorName\\PackageName\\PackageNamePackage": ["all"]

    }

}

STEP 3:

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

STEP 4:

  1. Inside src directory create the following directories
  2. 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
    • your 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. Routing directory contains metadata class files which tells 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 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
. . .

Comment

Add Your Comment

Be the first to comment.

css.php