Skip to content

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.

  1. This page (the map)
  2. Recommended development environment
  3. Your first plugin in 10 minutes
  4. Develop with AI coding tools
  5. 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.

Requests from the browser or the API enter Exment; plugins run inside Exment and use the database, files and outside servicesBrowserusers, administratorsAPI / MCPother systems, AIExment (Laravel)Login, permissions, CSRF, logAdd screenspage, dashboard, view, CRUDReact to operationsevent, button, validatorBring data in and outimport, export, documentRun in the backgroundbatch, APIChange the lookscript, styleDatabasetables, dataFilesattachments, pluginsOutside servicesAPIs, mail

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.

Typeplugin_typeWhat it doesHow to build
PagepageAdds a new screen to ExmentPage
DashboarddashboardAdds your own item to the dashboardDashboard
ViewviewAdds your own way to show a data listView
CRUD pagecrudLists, creates, updates and deletes outside data without storing it in ExmentCRUD
ButtonbuttonAdds a button to the list, calendar, details, create or edit screenButton
EventeventRuns before or after saving, after deleting, on workflow actions, on notifications, or when a screen loadsEvent
ValidatorvalidatorChecks the input values in your own way before savingValidation
BatchbatchRuns at a set time or from a commandBatch
APIapiAdds your own APIAPI
ImportimportImports files in your own formatImport
ExportexportExports a data list in your own formatExport
DocumentdocumentMakes documents such as quotes from an Excel templateDocument
ScriptscriptAdds JavaScript to screensScript
StylestyleAdds CSS to screensStyle
TriggertriggerThe old type. For new plugins, use a button or an eventTrigger

Which one to choose ​

You want toChoose
Make a screen of your ownPage
Show something small on the top screenDashboard
Show a data list like a kanban or a mapView
Change other columns or tables automatically on saveEvent (saving, saved)
Run something only when a person clicksButton
Check how fields relate to each otherValidator
Process data every nightBatch
Give other systems an entry pointAPI (when the standard API is not enough)
Edit data of an outside database on Exment's screensCRUD page
Change only the look a littleStyle, 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 with hasPermission(). 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 @csrf in 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=false in .env to 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.

Next ​

Recommended development environment