Developer guide
This page is for developers who want to add features to Exment.
It covers what you can build, which kind to choose, where the code runs, and the security basics.
If you are new, read the pages in this order.
- This page (the map)
- Recommended development environment
- Your first plugin in 10 minutes
- Develop with AI coding tools
- How to build each type (Plugin creation method) and the Plugin reference
Where a plugin fits in Exment
A plugin is PHP code that runs inside Exment (a Laravel application).
Exment itself handles login, permissions, the CSRF check and the operation log. Plugins run inside that.
What you can build (plugin types)
These are the values of plugin_type in config.json. They are the same as the list in Exment's PluginType.
| Type | plugin_type | What it does | How to build |
|---|---|---|---|
| Page | page | Adds a new screen to Exment | Page |
| Dashboard | dashboard | Adds your own item to the dashboard | Dashboard |
| View | view | Adds your own way to show a data list | View |
| CRUD page | crud | Lists, creates, updates and deletes outside data without storing it in Exment | CRUD |
| Button | button | Adds a button to the list, calendar, details, create or edit screen | Button |
| Event | event | Runs before or after saving, after deleting, on workflow actions, on notifications, or when a screen loads | Event |
| Validator | validator | Checks the input values in your own way before saving | Validation |
| Batch | batch | Runs at a set time or from a command | Batch |
| API | api | Adds your own API | API |
| Import | import | Imports files in your own format | Import |
| Export | export | Exports a data list in your own format | Export |
| Document | document | Makes documents such as quotes from an Excel template | Document |
| Script | script | Adds JavaScript to screens | Script |
| Style | style | Adds CSS to screens | Style |
| Trigger | trigger | The old type. For new plugins, use a button or an event | Trigger |
- One plugin can have more than one type (e.g.
"plugin_type": "page,dashboard"). See Support multiple plug-in types with one plugin. - For PDF forms, you can also use Docurain.
Which one to choose
| You want to | Choose |
|---|---|
| Make a screen of your own | Page |
| Show something small on the top screen | Dashboard |
| Show a data list like a kanban or a map | View |
| Change other columns or tables automatically on save | Event (saving, saved) |
| Run something only when a person clicks | Button |
| Check how fields relate to each other | Validator |
| Process data every night | Batch |
| Give other systems an entry point | API (when the standard API is not enough) |
| Edit data of an outside database on Exment's screens | CRUD page |
| Change only the look a little | Style, script |
Before you build a plugin, check whether a standard feature can do it. Data update settings, notifications, workflows and calculated columns are often enough.
Where plugins run
- Plugins run on the server. Their PHP runs with the same rights as Exment and connects to the same database.
- An uploaded zip is stored in
storage/app/plugins/(plugin name)/on the server (also in the cloud storage, when the file storage is set to one). - Pages, APIs and batches are called after Exment has checked the login and the permissions.
- The PHP and Laravel versions are the same as Exment's (Exment 7.x: PHP 8.2 or later, Laravel 12).
Security basics
A plugin is code that can do anything on the server. Follow these rules.
- Check permissions: read data with
CustomTable::getEloquent('table_name')->getValueQuery(). It returns only what the logged-in user may see. Check the table permission withhasPermission(). Raw SQL skips the permission check. - Decide who can use the plugin: for pages, APIs and others, choose the users with role groups. Set "All user can use" to YES only when it is needed.
- CSRF: POST, PUT and DELETE requests to a page are checked for CSRF. Put
@csrfin your forms. This check cannot be turned off. - Escaping: output values with Blade's double curly braces, as on the first line below (they are escaped). The second form does not escape; use it only for HTML you built yourself and know is safe.blade
<p>{{ $name }}</p> <div>{!! $safe_html !!}</div> - No secrets in code: let administrators enter API keys and passwords in the plugin settings (
setCustomOptionForm) and read them with$this->plugin->getCustomOption('key'). Do not put them in the zip or in Git. - Who can upload: uploading a plugin and editing its code are the same as running PHP on the server. When several companies share one Exment, set
EXMENT_PLUGIN_UPLOAD_ENABLED=falsein.envto turn off uploading and editing from the screen. - Try it locally first: run a new plugin on a local Exment before production (Recommended development environment).
To change Exment itself
To change Exment itself rather than write a plugin, see exceedone/exment on GitHub.
- Setting up a development environment: docs/development.md
- Sending a pull request: CONTRIBUTING.md
