Download the PHP package umanit/tree-bundle without Composer

On this page you can find all versions of the php package umanit/tree-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package tree-bundle

Purpose

The bundle allows you to easily manage content type routing, with the slug, breadcrumb and SEO

General configuration

As the routing for all content is managed by the bundle, you have to register the unique route at the end of your config/routes.yaml (in order to not override your custom routes):

Register the bundle to your config/bundles.php if you don't use Symfony Flex.

Add Gedmo configuration in your services.yaml or in a separate packages/gedmo.yaml. See documentation here

Update your database schema to add our model

or if you use DoctrineMigrationsBundle:

Now, you have to create the root node. The default object is RootEntity, but you can override it in configuration (param umanit_tree.root_class).

To create the root node, execute the following command

Create a new node type

You can now easily manage a new node type :

The 4 methods of TreeNodeInterface are :

You can manage some SEO options such as title, description and keywords with the Umanit\TreeBundle\Model\SeoInterface and use the Umanit\TreeBundle\Model\SeoTrait to automatically add an attribute "seoMetadata" to your entity

Bind a controller and get the entity

In order to bind a controller (or a template) to an entity, you have to configure the key node_types

The entity (or node) will be available in the request attribute.

Create a Parent Node selector

Usage example:

Create SEO Metadata Form

Usage example:

Create a link selector

It's possible to create links to one or more nodes (or external links).

In your entity that will have the link, add a relation with the entity Umanit\TreeBundle\Entity\Link.

In your forms, you can materialize the relation with the Umanit\TreeBundle\Form\Type\LinkType. By default, you'll have two fields, "internal link" (a textfield) and "external link" (a select). By default, the select will be empty. You have to populate it by giving the models allowed. You can keep only one field with the options : allow_internal: false or allow_external: false. Note : only one field can be filled at the same time.

You can define labels with label_internal and label_external

Usage example :

Events

You can subscribe to some events in order to alter some behaviors

(in order)

Twig helpers

Returns the title, description and keywords of the current document if the route is managed by an entity that implements SeoInterface. Otherwise, the default value (from config) will be used, or the value from "default" parameter if it is set. If you set override to true, the value of the "default" parameter will be always used.

Returns the breadcrumb (array of name/link). It will parse all parents of the current entity if the route is managed by an entity. You can add additional links with the "elements" parameter. An array of name/link.

Returns the route for the given entity (if the entity implements TreeNodeInterface)

Returns the route for the given node (instance of Umanit\TreeBundle\Entity\Node)

Returns the path for the given link instance (instance of Umanit\TreeBundle\Entity\Link).

Returns true if the given link targets an external URL (instance of Umanit\TreeBundle\Entity\Link).

Using the menu admin

/!\ For performance concerns, we chose to support PostgreSQL only.

Follow those two steps to get started:

1. Create your Menu entity (use annotations or attributes)

2. Configure TreeBundle to use your Menu entity

Usage

Front

TreeBundle doesn't come with a template for the menu. A global twig variable is injected to your site, use it to build your menu template(s).

Example:

Menu admin

A CRUD is provided in order to administrate your menus. It's available on the route tree_admin_menu_dashboard, /admin/menu.

/!\ You need to have the role ROLE_TREE_MENU_ADMIN in order to be able to access the route.

Start by running php bin/console assets:install to get the assets in your web/public directory.

Customizing the admin layout

The layout can be customized to your needs by setting the admin_layout configuration value.

Example if you want to use Sonata Admin's layout:

The menu admin has 3 javascript dependencies, you ought to include them as well. Have a look in the default_layout.html.twig.

TreeBundle ships with those assets, you may use them or your own.

Again, if you want to use it with SonataAdmin, configure it as follows:

Customizing the admin form

Let's assume you added an image attribute on your Menu entity and want to use VichUploader to administrate it.

First, Create a form type:

Then add your form type to TreeBundle's configuration:

Configuration reference


All versions of tree-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
gedmo/doctrine-extensions Version ~3.9
symfony/framework-bundle Version ^5.4|^6.0
doctrine/doctrine-bundle Version ^2.7
doctrine/orm Version ^2.13
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package umanit/tree-bundle contains the following files

Loading the files please wait ....