DEV Community

shoki
shoki

Posted on

Boilerplate and custom CRUD for Hubleto CRM

If you are CRM or ERP developer, experienced in PHP, you should have already heard about Hubleto. It is an opensource PHP-based CRM solution with a comprehensive set of features and modules in its free community version.

Here in this post, I will show how to easily create a boilerplate code and custom CRUD in a custom app (or module, if you wish).

Simply follow these steps and in few minutes you will have working CRM with your custom code.

Create Hubleto ERP project

Run composer to install Hubleto:

composer create-project hubleto/erp-project
Enter fullscreen mode Exit fullscreen mode

This will download the Hubleto's source code and all of its dependencies.

Install it

Go to the folder where you created the project and run:

php hubleto init
Enter fullscreen mode Exit fullscreen mode

This will install the database and create a default configuration. You will need to answer several questions (in most cases the default values are enough).

When done, your default Hubleto will be ready to use.

Download Hubleto using composer create-project

Create a custom app

In Hubleto, you can create unlimited number of custom apps. In this example, we will create an app for car rental management.

Run:

php hubleto create app CarRental
Enter fullscreen mode Exit fullscreen mode

Create CarRentals app

Add models

Each car rental management app needs a list of cars. We create a model Car that will hold the information about each car.

Run:

php hubleto create model CarRental Car
Enter fullscreen mode Exit fullscreen mode

You may repeat this process any number of times to create all models you need.

Create model Car

Add controllers, views and UI

Now, we have only models. Models are installed in the database but we do not have any UI to manage the data. Let's create it.

Run:

php hubleto create mvc CarRental Car
Enter fullscreen mode Exit fullscreen mode

Create UI for model Car

And that's it. Easy. This will create PHP controllers, TWIG views and React UI components. Now repeat the command for each model you created before.

Create UI for model Car

Compile everything together

Last step is to compile the React Javascript files and Tailwind CSS files.

Run:

npm install @hubleto/react-ui
npm run build
Enter fullscreen mode Exit fullscreen mode

Done

Now you're done. You can open you Hubleto at https://localhost/hubleto/erp-project (or similar, based on your environment setup) and manage cars.

Hubleto CRM customized with Car Rental app

Top comments (0)