71
When E-commerce meet Symfony #SymfonyCon

When e-commerce meets Symfony

Embed Size (px)

Citation preview

Page 1: When e-commerce meets Symfony

When E-commerce meet Symfony#SymfonyCon

Page 2: When e-commerce meets Symfony

@mmoreram

Elcodi

Page 3: When e-commerce meets Symfony

@mmoreram

Co-founder and lead at Elcodi

Organizer of Symfony Barcelona UG

Entrepreneur in AntaiVB - Barcelona

Maintainer of several open source Libs and Bundles (GearmanBundle, ControllerExtraBundle, Visithor, php-formatter, PaymentSuite…)

Page 4: When e-commerce meets Symfony

About this talk

E-commerce in PHP until 201*

E-commerce project life cycles

Architecture for pragmatic development

Symfony in action

3 tips about Elcodi

Page 5: When e-commerce meets Symfony

E-commerce + PHP until 201*

Page 6: When e-commerce meets Symfony

Ideal Marc dialogue

Marc: Hey dude, how are you?

Ideal developer, in an ideal environment with an ideal amount of money: …

Page 7: When e-commerce meets Symfony

Real Marc dialogue

Marc: Hey dude, how are you?

Real developer, in a real environment with a real amount of money: …

Page 8: When e-commerce meets Symfony

What has happened here???

Page 9: When e-commerce meets Symfony

PHP Until 201*

PHP Full-stack projects based mostly on final user needs

Old PHP code without change margin

Technological effort on maintenance over refactoring

Can these projects evolve?

Page 10: When e-commerce meets Symfony

PHP Until 201*

From the developer’s point of view…

Configuration

Configuration

Extension + Pain

Configuration

Page 11: When e-commerce meets Symfony

PHP Until 201*

No testing

No SOLID principles

Page 12: When e-commerce meets Symfony

PHP Until 201*

So… why are they that used?

A lot of users and developers have based their companies on them (YAY! Me, want!)

BIG and Extremely well created plugin and template markets

E-commerce with minimum time-to-market

Page 13: When e-commerce meets Symfony

Is that enough for me?

Page 14: When e-commerce meets Symfony

No is not!:’(

Page 15: When e-commerce meets Symfony

E-commerce life cycle

Page 16: When e-commerce meets Symfony

MVP

Minimum Valuable Project

The minimum you need to make sure you can measure the impact of your application - First stage… ALWAYS!

Small investment (FFF)

Small budget to spend on everything

Perfect for applications with advanced template and plugin markets

Page 17: When e-commerce meets Symfony

MVP

Technology is not used to being important here

And, in fact, it should never be…

Most of times, projects die after this stage because the market is not ready or the project is not valuable enough

Fast set-up technologies are used here

Page 18: When e-commerce meets Symfony

After MVP

Business Angels in action!

Bigger budget than before, but not as big as we’d love to

We can spend a little bit more on technology

This is where we need to make the difference, so…

Page 19: When e-commerce meets Symfony

Hello, Custom Business!!!

Page 20: When e-commerce meets Symfony

Bye Bye, 90% of all existing plugins!!!

Page 21: When e-commerce meets Symfony

After MVP

This is where a lot of companies start a refactoring process

This refactoring is used to costing too much money $$$

Everything is for yesterday :’(

Things are done poorly and rapidly

Pain^n

Page 22: When e-commerce meets Symfony

Do you know what this causes?

Page 23: When e-commerce meets Symfony

Sadness!

Page 24: When e-commerce meets Symfony

Frustration!

Page 25: When e-commerce meets Symfony

I hate E-commerce!

Page 26: When e-commerce meets Symfony

Bye Bye E-commerce!

Page 27: When e-commerce meets Symfony

After MVP : #tip

Choosing here your strategy can save your project!

As important as MVP, but even more difficult to manage

Smart decisions will be important

Page 28: When e-commerce meets Symfony

When Venture Capital

The amount of money is much bigger (shut up and take my money…)

We are going to be a player, so our technology must be a player as well

Time for do all these things you always had in mind

No excuses, you have to hire talent and be responsible

Page 29: When e-commerce meets Symfony

But you know what?

Page 30: When e-commerce meets Symfony

First of all, you need to

reach that point

Page 31: When e-commerce meets Symfony

Pragmatic Architecture

Page 32: When e-commerce meets Symfony

Just some questions…

Is PHP the right platform for that?

Page 33: When e-commerce meets Symfony

“is it?”

Page 34: When e-commerce meets Symfony

“it is, why not?”

Page 35: When e-commerce meets Symfony

Just some questions…

From a technical point of view… what criteria should I follow about when deciding an E-commerce platform?

Page 36: When e-commerce meets Symfony

Do I feel confortable working with it?

Will I be able to born with this project?

Plugins, Templates, User documentation

Will I be able to grow with this project?

Excellent technical documentation, Communication, Community

Some tips

Page 37: When e-commerce meets Symfony

Will I be able to increase my skills as developer using this technology?

Will I be able to do it… properly?

Will I (as a company) co-exist with this technology?

For how long?

Some tips

Page 38: When e-commerce meets Symfony

“Do I feel confortable working with it?”

Page 39: When e-commerce meets Symfony

Just some questions…

Should I test my MVP application?

Page 40: When e-commerce meets Symfony

Some tips

Take a tested (or popular) platform when you need to reach your MVP

If your project is not going to grow, take the project with the most advanced plugin and template system. Forget about everything else

You may not care about the roadmap of the project if your project ends as soon as you finish it

Page 41: When e-commerce meets Symfony

Some tips

If your project is LTS, then… tests battery will only tell you if the initial product works properly

You will really need tests after your MVP, and your application will be completely different

You will have to do your own tests then. Be ready for that!

That one of the things you could invest on with your new money :)

Page 42: When e-commerce meets Symfony

Just some questions…

What architecture should I use?

Page 43: When e-commerce meets Symfony

“What architecture I really need?”

Page 44: When e-commerce meets Symfony

Some tips

What architecture allow you to overwrite more easily

Cart, Product, Shipping, Payment

Admin functionalities, integrations, change capacity

What architecture allow your team to understand the business model?

What part of the application handles your business logic? Service layer? Model? Commands + Controllers + EventListeners + Twig Extensions?

CQRS, Event-Driven Design… do you really know how it works?

Annotations at the beginning, maybe? Easier :)

Page 45: When e-commerce meets Symfony

Choose the architecture that

really fits your case

Page 46: When e-commerce meets Symfony

Some tips

As soon as your developers (or you) are better, then your needs will be bigger and stronger

Technology will follow you, not vice versa

Don’t base your E-commerce on practices you don’t really know how to handle with

Page 47: When e-commerce meets Symfony

And the more better you are…

Page 48: When e-commerce meets Symfony

… the more alternatives you’ll find

Page 49: When e-commerce meets Symfony

Some tips

Annotations will become bad practices, maybe

You will understand that an Event Listener, for example, should have 0 business Logic (Same as other entry points)

You will NEED tests in all your developments. Not for the “tested” badge on Github, but only for you

You will understand as well why ValueObjects are great, for example

Page 50: When e-commerce meets Symfony

Symfony in action

Page 51: When e-commerce meets Symfony

Symfony

What parts of Symfony can really help us on our adventure <E-commerce case>!

Event Dispatcher

Symfony DIC

Tests integrations (PHPUnit, Behat, Visithor…)

Bundles

Page 52: When e-commerce meets Symfony

Event Dispatcher

Event-Driven Design is one of the most important things when you want to build a Plugin-based environment

+Events = +Extension points = +Adopters = +Integrations

Page 53: When e-commerce meets Symfony

DIC

How easy overwriting a service is by registering your own service with the same name (after the original one)

Good for composition and inheritance

+Easy to overwrite = +Customizations = +Adopters = +Installations

Page 54: When e-commerce meets Symfony

Tests integrations

Integrations with Testing Platforms

Behat Symfony2 Extension (Symfony3?)

Symfony PHPUnit Bridge

VisithorBundle

Page 55: When e-commerce meets Symfony

Bundles

Why a bundle is something relevant here?

How a bundle can help when trying to create a Plugin + Template environment…

Page 56: When e-commerce meets Symfony

A Bundle can be a Plugin!

Page 57: When e-commerce meets Symfony

3 tips about Elcodi

Page 58: When e-commerce meets Symfony

Elcodi

Set of E-commerce PHP Components

Set of Symfony2 bundles for these components

Project called Bamboo. Full stack E-commerce based on Elcodi + Symfony components and bundles.

http://github.com/elcodi

By giving us a star is like… Hey guys! You’re cool ;)

Page 59: When e-commerce meets Symfony

Elcodi Tip #1

Intended to be a great option for MVPs

Create a Plugin environment on top of Symfony Bundles

Template as a Plugin

Install in less than 2 minutes with Heroku (i.e.)

4 layers of testing

Page 60: When e-commerce meets Symfony

Elcodi Tip #1

[Components] PHPUnit for unit testing of our Service Layer (classes)

[Bundles] PHPUnit for functional testing of our processes (services, event listeners, event dispatchers…)

[Bamboo] Behat for behavioral testing (user processes…)

[Bamboo] Visithor just for testing the HTTP layer (responses)

Page 61: When e-commerce meets Symfony

Visithor

http://github.com/visithor/VisithorBundle

You only need a single and small YAML file, and some lines. One per route.

Define your routes by url, url name (Visithor) + parameters (VitithorBundle)

Authenticate in a Firewall with a ROLE (Admin routes)

Page 62: When e-commerce meets Symfony

Visithor

Page 63: When e-commerce meets Symfony

Elcodi Tip #2

Intended to be a great option after MVP

Use Symfony ecosystem for evolving your project. No refactoring needs

The project is built on top of some Best Practices, and is treated with A LOT OF LOVE

Both developer and final user oriented. No one is less important than the other one

Page 64: When e-commerce meets Symfony

Elcodi Tip #3

Community-Driven. Developers are the brain of any open source project. Final users are the heart

The more happiness any open source project provides, the more quality offers

Join us on this adventure :)

http://gitter.im/elcodi/elcodi

Page 65: When e-commerce meets Symfony

Elcodi Extra Tip

Elcodi (L) Symfony ^3.0.0 (December 2015)

Elcodi App Market (2016)

And… much, more, soon!

Emanuele Minotto, new Core dev :) Thanks dude!

Page 66: When e-commerce meets Symfony

TB;WS

Page 67: When e-commerce meets Symfony

TB;WSToo Boring; Was Sleeping

Page 68: When e-commerce meets Symfony

TB;WS

Each E-commerce stage needs different strategies

Check all Symfony E-commerce solutions, and find the one who REALLY makes you feel comfortable

And if you really love E-commerce… consider getting involved in one of them, and spread the word :)

and meanwhile… read!

Page 69: When e-commerce meets Symfony

Q / A

Page 70: When e-commerce meets Symfony

Differences Elcodi - ~^.*$~

Elcodi is a ready-for-production project

We offer both a project and a way of doing, of understanding open source and collaborative projects

Just make sure you discover this way of doing, and join us if you really enjoy it

We are still waiting for your feedback and energy :)

Page 71: When e-commerce meets Symfony

Thanks! Gràcies!

@mmoreram