Skip to main content

Package development

Creating packages for the Qore is the same as creating packages for your Laravel projects. Laravelpackage.com provides good documentation for the development of a Laravel package.

You might use the following Qore Module template for reference to get started: https://gitlab.qlic.nl

Testing locally

When developing your package, it's good practise to require your package via a custom composer repository.

For example, when you have created a qore/crm module inside qore/modules/qore-crm, your main composer.json should look like:

composer.json
{
...

"require": {
"qore/crm": "dev-develop"
},
"repositories": {
"0": {
"type": "path",
"url": "./qore/modules/qore-crm"
},
...
},
...
}

Registering a resource

If you want to register a resource from within a package, you can do it in the service provider:

class CRMServiceProvider extends ServiceProvider
{
public function register()
{
//
}

public function boot()
{
app(Resources::class)->register(new Employee);
app(Resources::class)->register(new Project);
}
}

Adding Vue templates

Your package may have custom Vue components that should be accessible from your root project.

See this guide on how to achieve this: https://medium.com/@damijolayemi/workflow-tip-how-to-use-vuejs-in-a-laravel-package-71fef6ea1d12

To summarize, your package should publish a Vue template:

    public function boot()
{
$this->publishes([
__DIR__ . '/../resources/components' => base_path('frontend/src/vendor/issue-tracker')
], 'vue-components');
}

Then in your frontend, you may include this template (in frontend/src/boot/modules.js):

import IssueTracker from 'vendor/issue-tracker/IssueTracker'

Vue.component('IssueTracker', IssueTracker)

After you have registered your component, you can use it globally in your application.