StripeCon EU 2018 - SilverStripe 4 application framework

Andy Adiwidjaja
Andy AdiwidjajaGeschäftsführender Gesellschafter at Adiwidjaja Teamworks GmbH
StripeCon EU 2018 - SilverStripe 4 application framework
/me
●
Web based business applications
●
Technology agnostic
●
PHP, Python, NodeJS, React,
●
Silverstripe, Laravel, Django
●
More consultant than developer
Criteria for frameworks
●
Results fast!
●
Incremental development
●
Simple but extensible structure
●
Stability: Static and dynamic
Framework Features
●
ORM
●
Admin Scaffolding
●
Integrated security
●
Form generation, scaffolding
StripeCon EU 2018 - SilverStripe 4 application framework
Example: Everyday problems
StripeCon EU 2018 - SilverStripe 4 application framework
Installation: Init
●
Prerequisites: PHP 7.2, composer
> mkdir monsters
> cd monsters
> composer init
Minimum Stability []: dev
Package Type []: project
License []: BSD-3-Clause
“prefer-stable”: true
Installation: Recipe
# Important to do now!
> mkdir public
# Base recipe
> composer require silverstripe/recipe-core
# Admin
> composer require silverstripe/admin
# File handling
> composer require silverstripe/asset-admin
...large output...
Installation: Confg fles
# .env
SS_DATABASE_CLASS="MySQLPDODatabase"
SS_DATABASE_SERVER="localhost"
SS_DATABASE_USERNAME="root"
SS_DATABASE_PASSWORD="root"
SS_DATABASE_NAME="monsters"
SS_DEFAULT_ADMIN_USERNAME="admin"
SS_DEFAULT_ADMIN_PASSWORD="admin"
SS_ENVIRONMENT_TYPE="dev"
> vendor/bin/sake dev/build
# .gitignore
/.env
/vendor/
/silverstripe-cache/
/public/resources/
/public/assets/*
/.idea
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
ModelAdmin
app/src/controllers/MonsterController.php
<?php
namespace AppAdmin;
use SilverStripeAdminModelAdmin;
use AppModelsMonster;
class MonsterAdmin extends ModelAdmin {
private static $url_segment = "monsters";
private static $menu_title = "Monsters";
private static $menu_priority = 1;
private static $managed_models = [
Monster::class
];
}
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
The Controller
app/src/controllers/MonsterController.php
<?php
namespace AppControllers;
use SilverStripeControlController;
class MonsterController extends Controller {
}
Routing
app/_confg/routes.yml
---
Name: approutes
After: framework/_config/routes#coreroutes
---
SilverStripeControlDirector:
rules:
'monsters//$Action/$ID': AppControllersMonsterController
'': AppControllersMonsterController
StripeCon EU 2018 - SilverStripe 4 application framework
The View
app/src/controllers/
MonsterController.php
use SilverStripeControlController;
use AppModelsMonster;
class MonsterController extends Controller {
public function index($request)
{
return [
'Title' => 'Monsters',
'Objects' => Monster::get()
];
}
}
app/templates/App/Controllers/
MonsterController.ss
<h1 class="title">$Title</h1>
<% if $Monsters %>
<div class="columns">
<% loop $Monsters %>
<div class="column is-one-third">
<div class="box">
$Image.Fill(300, 200)
<p>$Name</p>
</div>
</div>
<% end_loop %>
</div>
<% end_if %>
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
Frontend editing!
●
German: DAU
●
Feel at home (branding)
●
Everyday tasks
●
Uncommon tasks
As simple as possible
Editing
app/src/controllers/MonsterController.php
class MonsterController extends Controller {
private static $allowed_actions = [
"edit",
"EditForm"
];
public function EditForm() {…}
public function edit(HTTPRequest $request) {}
public function save(array $data, Form $form) {}
}
Editing
app/src/controllers/MonsterController.php:EditForm()
$colors = Monster::singleton()->dbObject('Color')->enumValues();
$fields = FieldList::create(
TextField::create("Name", "Name"),
TextField::create("Eyes", "Number of eyes"),
DropdownField::create("Color", "Main color", $colors),
FileField::create("Image", "Image"),
HiddenField::create("ID", "ID")
);
$actions = FieldList::create(
FormAction::create('save','Save')->addExtraClass('is-primary')
);
$validator = RequiredFields::create('Name');
Editing
app/src/controllers/MonsterController.php
public function edit(HTTPRequest $request) {
$form = $this->EditForm();
$monster = null;
if($id = (int) $request->param("ID")) {
$monster = Monster::get()->byID($id);
$form->loadDataFrom($monster);
}
return [
'Monster' => $monster,
'Form' => $form
];
}
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
StripeCon EU 2018 - SilverStripe 4 application framework
Editing
app/src/controllers/MonsterController.php
public function save(array $data, Form $form) {
if($id = $data["ID"]) {
$monster = Monster::get()->byID($id);
} else {
$monster = Monster::create();
}
$form->saveInto($monster);
$monster->write();
$this->redirect($this->Link("view/$monster->ID"));
}
StripeCon EU 2018 - SilverStripe 4 application framework
SilverStripe as Framework
●
Batteries included
– Versioning, Translations, Extensions, REST
●
Admin
●
Very fast development cycle (dev/build)
●
Confguration not always transparent
●
SilverStripe 4 was a big step
StripeCon EU 2018 - SilverStripe 4 application framework
1 of 51

Recommended

twMVC#44 如何測試與保護你的 web application with playwright by
twMVC#44 如何測試與保護你的 web application with playwrighttwMVC#44 如何測試與保護你的 web application with playwright
twMVC#44 如何測試與保護你的 web application with playwrighttwMVC
468 views65 slides
Nodejs web,db,hosting by
Nodejs web,db,hostingNodejs web,db,hosting
Nodejs web,db,hostingKenu, GwangNam Heo
817 views22 slides
#2 Hanoi Magento Meetup - Part 2: Knockout JS by
#2 Hanoi Magento Meetup - Part 2: Knockout JS#2 Hanoi Magento Meetup - Part 2: Knockout JS
#2 Hanoi Magento Meetup - Part 2: Knockout JSHanoi MagentoMeetup
480 views23 slides
Horizontally Scaling Node.js and WebSockets by
Horizontally Scaling Node.js and WebSocketsHorizontally Scaling Node.js and WebSockets
Horizontally Scaling Node.js and WebSocketsJames Simpson
1.5K views11 slides
Web development using nodejs by
Web development using nodejsWeb development using nodejs
Web development using nodejsVaisakh Babu
291 views10 slides
Server Side Apocalypse, JS by
Server Side Apocalypse, JSServer Side Apocalypse, JS
Server Side Apocalypse, JSMd. Sohel Rana
749 views14 slides

More Related Content

What's hot

First Step towards WebAssembly with Rust by
First Step towards WebAssembly with RustFirst Step towards WebAssembly with Rust
First Step towards WebAssembly with RustKnoldus Inc.
84 views22 slides
WebAssembly with Rust by
WebAssembly with RustWebAssembly with Rust
WebAssembly with RustKnoldus Inc.
159 views26 slides
Javascript Bundling and modularization by
Javascript Bundling and modularizationJavascript Bundling and modularization
Javascript Bundling and modularizationstbaechler
821 views31 slides
Windows azure and linux by
Windows azure and linuxWindows azure and linux
Windows azure and linuxAndrey Kucherenko
3.9K views17 slides
Improving WordPress Performance with Xdebug and PHP Profiling by
Improving WordPress Performance with Xdebug and PHP ProfilingImproving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP ProfilingOtto Kekäläinen
11.2K views47 slides
[Js hcm] Deploying node.js with Forever.js and nginx by
[Js hcm] Deploying node.js with Forever.js and nginx[Js hcm] Deploying node.js with Forever.js and nginx
[Js hcm] Deploying node.js with Forever.js and nginxNicolas Embleton
7K views17 slides

What's hot(20)

First Step towards WebAssembly with Rust by Knoldus Inc.
First Step towards WebAssembly with RustFirst Step towards WebAssembly with Rust
First Step towards WebAssembly with Rust
Knoldus Inc.84 views
WebAssembly with Rust by Knoldus Inc.
WebAssembly with RustWebAssembly with Rust
WebAssembly with Rust
Knoldus Inc.159 views
Javascript Bundling and modularization by stbaechler
Javascript Bundling and modularizationJavascript Bundling and modularization
Javascript Bundling and modularization
stbaechler821 views
Improving WordPress Performance with Xdebug and PHP Profiling by Otto Kekäläinen
Improving WordPress Performance with Xdebug and PHP ProfilingImproving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP Profiling
Otto Kekäläinen11.2K views
[Js hcm] Deploying node.js with Forever.js and nginx by Nicolas Embleton
[Js hcm] Deploying node.js with Forever.js and nginx[Js hcm] Deploying node.js with Forever.js and nginx
[Js hcm] Deploying node.js with Forever.js and nginx
Nicolas Embleton7K views
Nuxt로 사내서비스 구현하면서 얻은 경험 공유 by 민환 조
Nuxt로 사내서비스 구현하면서 얻은 경험 공유Nuxt로 사내서비스 구현하면서 얻은 경험 공유
Nuxt로 사내서비스 구현하면서 얻은 경험 공유
민환 조6.5K views
Pre-render Blazor WebAssembly on static web hosting at publishing time by Jun-ichi Sakamoto
Pre-render Blazor WebAssembly on static web hosting at publishing timePre-render Blazor WebAssembly on static web hosting at publishing time
Pre-render Blazor WebAssembly on static web hosting at publishing time
Jun-ichi Sakamoto1.1K views
AEM WITH MONGODB by Nate Nelson
AEM WITH MONGODBAEM WITH MONGODB
AEM WITH MONGODB
Nate Nelson1.9K views
Bower & Grunt - A practical workflow by Riccardo Coppola
Bower & Grunt - A practical workflowBower & Grunt - A practical workflow
Bower & Grunt - A practical workflow
Riccardo Coppola5.8K views
An Introduction to Node.js Development with Windows Azure by Troy Miles
An Introduction to Node.js Development with Windows AzureAn Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows Azure
Troy Miles1.2K views
Florian Koch - Monitoring CoreOS with Zabbix by Zabbix
Florian Koch - Monitoring CoreOS with ZabbixFlorian Koch - Monitoring CoreOS with Zabbix
Florian Koch - Monitoring CoreOS with Zabbix
Zabbix2.1K views
Advanced front-end automation with npm scripts by k88hudson
Advanced front-end automation with npm scriptsAdvanced front-end automation with npm scripts
Advanced front-end automation with npm scripts
k88hudson2.9K views
Phantom js quick start by ji guang
Phantom js quick startPhantom js quick start
Phantom js quick start
ji guang1.9K views

Similar to StripeCon EU 2018 - SilverStripe 4 application framework

#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers by
#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers
#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With ContainersHanoi MagentoMeetup
367 views42 slides
Grunt.js and Yeoman, Continous Integration by
Grunt.js and Yeoman, Continous IntegrationGrunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous IntegrationDavid Amend
30.8K views63 slides
Profiling PHP with Xdebug / Webgrind by
Profiling PHP with Xdebug / WebgrindProfiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindSam Keen
43.8K views35 slides
Container Security - Let's see Falco and Sysdig in Action by Stefan Trimborn by
Container Security - Let's see Falco and Sysdig in Action by Stefan Trimborn Container Security - Let's see Falco and Sysdig in Action by Stefan Trimborn
Container Security - Let's see Falco and Sysdig in Action by Stefan Trimborn ContainerDay Security 2023
22 views25 slides
Zend by
ZendZend
ZendMohamed Ramadan
326 views100 slides
Comment améliorer le quotidien des Développeurs PHP ? by
Comment améliorer le quotidien des Développeurs PHP ?Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?AFUP_Limoges
2.1K views74 slides

Similar to StripeCon EU 2018 - SilverStripe 4 application framework(20)

#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers by Hanoi MagentoMeetup
#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers
#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers
Grunt.js and Yeoman, Continous Integration by David Amend
Grunt.js and Yeoman, Continous IntegrationGrunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous Integration
David Amend30.8K views
Profiling PHP with Xdebug / Webgrind by Sam Keen
Profiling PHP with Xdebug / WebgrindProfiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
Sam Keen43.8K views
Comment améliorer le quotidien des Développeurs PHP ? by AFUP_Limoges
Comment améliorer le quotidien des Développeurs PHP ?Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?
AFUP_Limoges2.1K views
PhoneGap Day 2016 EU: Creating the Ideal Cordova Dev Environment by Ryan J. Salva
PhoneGap Day 2016 EU: Creating the Ideal Cordova Dev EnvironmentPhoneGap Day 2016 EU: Creating the Ideal Cordova Dev Environment
PhoneGap Day 2016 EU: Creating the Ideal Cordova Dev Environment
Ryan J. Salva570 views
Cloud Best Practices by Eric Bottard
Cloud Best PracticesCloud Best Practices
Cloud Best Practices
Eric Bottard1.3K views
What makes me "Grunt"? by Fabien Doiron
What makes me "Grunt"? What makes me "Grunt"?
What makes me "Grunt"?
Fabien Doiron3.6K views
DCSF 19 Building Your Development Pipeline by Docker, Inc.
DCSF 19 Building Your Development Pipeline  DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline
Docker, Inc.467 views
Craft CMS: Beyond the Small Business; Advanced tools and configurations by Nate Iler
Craft CMS: Beyond the Small Business; Advanced tools and configurationsCraft CMS: Beyond the Small Business; Advanced tools and configurations
Craft CMS: Beyond the Small Business; Advanced tools and configurations
Nate Iler155 views
Running MongoDB Enterprise on Kubernetes by Ariel Jatib
Running MongoDB Enterprise on KubernetesRunning MongoDB Enterprise on Kubernetes
Running MongoDB Enterprise on Kubernetes
Ariel Jatib568 views
Continuous Delivery com Docker, OpenShift e Jenkins by Bruno Padilha
Continuous Delivery com Docker, OpenShift e JenkinsContinuous Delivery com Docker, OpenShift e Jenkins
Continuous Delivery com Docker, OpenShift e Jenkins
Bruno Padilha226 views
Ansible Automation to Rule Them All by Tim Fairweather
Ansible Automation to Rule Them AllAnsible Automation to Rule Them All
Ansible Automation to Rule Them All
Tim Fairweather1.5K views
Continuous integration / continuous delivery by EatDog
Continuous integration / continuous deliveryContinuous integration / continuous delivery
Continuous integration / continuous delivery
EatDog545 views
Automating complex infrastructures with Puppet by Kris Buytaert
Automating complex infrastructures with PuppetAutomating complex infrastructures with Puppet
Automating complex infrastructures with Puppet
Kris Buytaert3.2K views
Automating Complex Setups with Puppet by Kris Buytaert
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with Puppet
Kris Buytaert1.2K views
Continuous Integration/ Continuous Delivery of web applications by Evgeniy Kuzmin
Continuous Integration/ Continuous Delivery of web applicationsContinuous Integration/ Continuous Delivery of web applications
Continuous Integration/ Continuous Delivery of web applications
Evgeniy Kuzmin378 views

Recently uploaded

The Path to DevOps by
The Path to DevOpsThe Path to DevOps
The Path to DevOpsJohn Valentino
6 views6 slides
POS Software in Bangladesh.pdf by
POS Software in Bangladesh.pdfPOS Software in Bangladesh.pdf
POS Software in Bangladesh.pdfSEOServiceProviderBa
6 views1 slide
Playwright Retries by
Playwright RetriesPlaywright Retries
Playwright Retriesartembondar5
7 views1 slide
Introduction to Git Source Control by
Introduction to Git Source ControlIntroduction to Git Source Control
Introduction to Git Source ControlJohn Valentino
9 views18 slides
Mobile App Development Company by
Mobile App Development CompanyMobile App Development Company
Mobile App Development CompanyRichestsoft
6 views6 slides
Introduction to Gradle by
Introduction to GradleIntroduction to Gradle
Introduction to GradleJohn Valentino
8 views7 slides

Recently uploaded(20)

Introduction to Git Source Control by John Valentino
Introduction to Git Source ControlIntroduction to Git Source Control
Introduction to Git Source Control
John Valentino9 views
Mobile App Development Company by Richestsoft
Mobile App Development CompanyMobile App Development Company
Mobile App Development Company
Richestsoft 6 views
tecnologia18.docx by nosi6702
tecnologia18.docxtecnologia18.docx
tecnologia18.docx
nosi67026 views
JioEngage_Presentation.pptx by admin125455
JioEngage_Presentation.pptxJioEngage_Presentation.pptx
JioEngage_Presentation.pptx
admin1254559 views
Top-5-production-devconMunich-2023-v2.pptx by Tier1 app
Top-5-production-devconMunich-2023-v2.pptxTop-5-production-devconMunich-2023-v2.pptx
Top-5-production-devconMunich-2023-v2.pptx
Tier1 app9 views
Transport Management System - Shipment & Container Tracking by Freightoscope
Transport Management System - Shipment & Container TrackingTransport Management System - Shipment & Container Tracking
Transport Management System - Shipment & Container Tracking
Freightoscope 6 views
Streamlining Your Business Operations with Enterprise Application Integration... by Flexsin
Streamlining Your Business Operations with Enterprise Application Integration...Streamlining Your Business Operations with Enterprise Application Integration...
Streamlining Your Business Operations with Enterprise Application Integration...
Flexsin 5 views
predicting-m3-devopsconMunich-2023-v2.pptx by Tier1 app
predicting-m3-devopsconMunich-2023-v2.pptxpredicting-m3-devopsconMunich-2023-v2.pptx
predicting-m3-devopsconMunich-2023-v2.pptx
Tier1 app14 views
Advanced API Mocking Techniques Using Wiremock by Dimpy Adhikary
Advanced API Mocking Techniques Using WiremockAdvanced API Mocking Techniques Using Wiremock
Advanced API Mocking Techniques Using Wiremock
Dimpy Adhikary5 views
Electronic AWB - Electronic Air Waybill by Freightoscope
Electronic AWB - Electronic Air Waybill Electronic AWB - Electronic Air Waybill
Electronic AWB - Electronic Air Waybill
Freightoscope 7 views
University of Borås-full talk-2023-12-09.pptx by Mahdi_Fahmideh
University of Borås-full talk-2023-12-09.pptxUniversity of Borås-full talk-2023-12-09.pptx
University of Borås-full talk-2023-12-09.pptx
Mahdi_Fahmideh13 views

StripeCon EU 2018 - SilverStripe 4 application framework