First external Hubleto app
External Hubleto apps are published as git repositories (either public/private github or on your git server).
They can be reused using composer require.
Install Hubleto
You will need Hubleto installation to test your app.
cd /var/www/html/hubletocomposer create-project hubleto/install . --stability=devnpm install & npm run buildphp hubleto init
Now your Hubleto should be available through some localhost address. We will use http://localhost/hubleto as an example.
Prepare app's repository
Create empty git repository for your app. No matter where but in this example we will use github.
Prepare app's scaffolding
Following steps guide you through preparation of the minimal set of files. Final folders and files should look followingly:
~/hubleto/your-app-name
├─ src/ # app's functionality
│ ├─ Loader.php # backend entry point
│ └─ manifest.yaml # app identification
├─ composer.json # description of your package for composer
├─ .gitignore # counts for badges and alerts
└─ README.md # short description of your app
- Clone your empty app's repository to any folder you want
Note: We will use
~/hubleto/your-app-nameas the home folder of your app.
- Add
composer.json, replace vendor name and app name
{
"name": "your-vendor-name/your-app-name",
"description": "My First External Hubleto App",
"autoload": {
"psr-4": {
"Hubleto\\App\\External\\YourVendorName\\YourAppName\\": "src"
}
},
"minimum-stability": "dev"
}
- Add
.gitignore
.vscode
vendor
composer.lock
package-lock.json
- Add
README.md
# You App Name
Describe your app here.
- Add app's
src/manifest.yaml
namespace: Hubleto\App\External\YourVendorName\YourAppName
appType: external
monthlyPricePerUser: 10
sidebarGroup: sales
rootUrlSlug: your-app-name
name: Your App Name
highlight: One-sentence description of your app
icon: fas fa-puzzle-piece
- Add app's minimal
src/Loader.php
<?php
namespace Hubleto\App\External\YourVendorName\YourAppName;
class Loader extends \Hubleto\Erp\App { }
Install local app into Hubleto
Now you need to link your app with your Hubleto installation so that each change in your app will be immediately reflected in your Hubleto.
- Go to your Hubleto folder
cd /var/www/html/hubleto
- Modify
composer.jsonto use your local app's repository
...
"require": {
"your-vendor-name/your-app-name": "dev-main"
},
"repositories": [{
"type": "vcs",
"url": "~/hubleto/your-app-name/"
}],
...
- Add the local app into your Hubleto
composer update
- Install the app into Hubleto
php hubleto app install Hubleto\App\External\YourVendorName\YourAppName
Test it
Navigate to http://localhost/hubleto and if you see your app in the left sidebar, you are ready to build the app.
