Building Multi-Tenant and SaaS products in PHP with the open source Innomatic Platform.
Let’s look at how you can build multi-tenant applications and SaaS products in PHP faster and better with the open source Innomatic Platform.
Presentation at CloudConf 2015
3. First of all: what is NOT Innomatic?
Innomatic is NOT a framework like Laravel or Symfony
– in fact, we are progressively migrating to a system
based on Symfony components!
3
4. So, what really is Innomatic?
Innomatic is an open source platform for:
developing, deploying and managing
Multi-Tenant and SaaS web applications in PHP
4
6. Building new SaaS: Classic vs Innomatic approach
6Innomatic Platform
Go
live!
Classic
life
cycle
Innoma,c
life
cycle
Learn
and
configure
Innoma4c
+
4me
+
budget
to
develop
&
market
the
app
Innomatic Platform
Go
live!
(late…)
Develop
infrastructure
(mul4
tenancy,
build
system,
billing
tools,
CRM,
etc.)
-‐
Time
-‐
budget
to
develop
&
market
the
app
Opt.:
Innomedia
CMF
for
web
sites
+
Innowork
BAF
for
intranets
7. Innomatic Layers
7Innomatic Platform
Debug
Tenant
Web
Apps
HTTP
Kernel
File
system
Rou4ng
Cache
Localiza4on
Logging
Web
services
Symfony
Components
based
deploy
and
tasks
AppCentral
Root
Desktop
Tenant
Desktop
Panels
/
Web
User
Interface
Dependency
Injec4on
Database
/
ORM
Templa4ng
Class
Loader
Mul4
tenancy
Applica4ons
container
Tenant
Users
/
RBAC
Packages
Composer
Innoma4c
Innomedia
CMF
Innowork
BAF
SaaS
tools
(billing,
CRM,
4ckets,
…)
Other
major
Frameworks
and
tools
PLATFORM
10. Innomatic = Innovation + AUTOMATIC
Innomatic handles this for you
Deployment and update tasks are
automatized by Innomatic for each tenant
10Innomatic Platform
11. An Innomatic application is a set of components of the types supported
by Innomatic or other Innomatic based applications:
• PHP classes,
• database tables,
• catalogues of localization strings,
• dashboard widgets,
• desktop UI elements,
• traybar items,
• maintenance tasks,
• etc.
Structure of an Innomatic application
11Innomatic Platform
12. This is the core of Innomatic automation at runtime.
Each component type defines the operation to be executed
in the following phases:
Innomatic components operations
Innomatic Platform 12
Application:
• Deploy inside Innomatic
• Upgrade
• Undeploy
Tenant:
• Enable component to the tenant
• Upgrade component in the tenant
• Disable component from the
tenant
15. <components>
<tempdir name="example-basic-app" />
<domaingroup name="examples"
catalog="example-basic-app::misc" />
<domaintable name="example_basic_table"
file="example_basic_table.xml" />
<domainpanel name="basicapp"
catalog="example-basic-app::misc" category="examples" />
<catalog name="example-basic-app" />
<class name="examples/basic/BasicClass.php" />
</components>
</application>
The application.xml file 3/3 – Components
Innomatic Platform 15
You
can
also
use
Composer
for
your
classes
16. You can also declare your dependencies to external packages
using Composer: you only have to add your composer.json
inside your application package.
Since Innomatic is a platform and you deploy applications at
runtime, Innomatic provides a recursive Composers
dependencies feature with multiple composer.json from different
Innomatic applications.
Including classes and packages with Composer
Innomatic Platform 16
17. Applications may also define their own component types that can be used by
other applications.
Extending Component Types
Innomatic Platform 17
18. Normally Innomatic desktop applications are built up
of various panels which provide an USER
INTERFACE inside the Innomatic desktop.
Panels & Panel Groups
Innomatic Platform 18
20. class BasicappPanelViews extends InnomaticDesktopPanelPanelViews
{
public function update($observable, $arg = '’) {}
public function beginHelper() {}
public function endHelper() {}
public function viewDefault($eventData)
{
$this->tpl->set(’title', ‘Panel title’);
}
}
Panel views – View code example
Innomatic Platform 20
21. class BasicappPanelActions extends InnomaticDesktopPanelPanelActions {
public function __construct(InnomaticDesktopPanelPanelController $controller) {
parent::__construct($controller);
}
public function beginHelper() {}
public function endHelper() {}
public function executeDeleteItem($eventData) {
$this->dataAccess->execute(‘DELETE FROM my_items WHERE ID=‘.$eventData[‘id’]);
}
}
Panel actions – Code example
Innomatic Platform 21
25. Tenant Desktops and Web Apps
Tenants have 2 types of interfaces:
Tenant Desktop
A web desktop with a standard GUI for backoffice applications accessible via a
login panel.
e.g. intranet, enterprise applications
Web App
An interface for external web applications with a chained router
e.g. public web sites, extranets
The Tenant Desktop and the Web App share the same database and can interact
(e.g. you may have a CMS inside the Desktop for managing the Web App
content).
25Innomatic Platform
48. You can also do it inside PHP and CLI scripts
Creating a tenant from CLI:
php core/scripts/tenant.php create <tenant_name>
<description> <admin_password>
Deploying an application from CLI:
php core/scripts/application.php deploy
<application_archive.tgz>
Enabling an application to a tenant from CLI:
php core/scripts/tenant.php appenable <tenantname>
<appname>
48Innomatic Platform