Join top global IT employer
- Accenture is the #1 largest independent technology services provider
- One of the world’s most admired companies: (FORTUNE’s “World’s Most Admired Companies” list)
- Serving clients in more than 120 countries
- Working across more than 40 industries
- 336,000 employees all over the world
- Net revenues of US$30.0 billion for fiscal 2014
Accenture Latvia
- #nr1 IT employer in IT industry
- Accenture Latvia is the largest IT company based on number of IT employees
- Company has a headcount of more than 700 employees
- Offices in Riga and Ventspils
- Operating in Latvia since 2002
- Main clients represent industries: communications& media, finances, public sector, products industry
- Strong, sportive and friendly team
What are frameworks?
Why use them?
What is Symfony?
Symfony is a set of PHP Components, a Web Application framework, a Philosophy, and a Community — all working together in harmony.
6 good reasons to use Symfony
1. Reputation
2. Permanence
3. References
4. Innovation
5. Resources
6. Interoperability
Components
- Asset
- ClassLoader
- Config
- Console
- DependencyInjection
- Filesystem
- Finder
- Form
- HttpFoundation
- HttpKernel
- Process
- PropertyAccess
- Routing
- Security
- Serializer
- Stopwatch
- Templating
- Translation
- Yaml
- ...
Bundles
Request Lifecycle
Source: http://symfony.com/doc/current/book/routing.html
Meet the Twig
The flexible, fast, and secure template engine for PHP
<?php echo $var ?>
<?php echo htmlspecialchars($var, ENT_QUOTES, 'UTF-8') ?>
{{ var }}
{{ var|escape }}
{% for user in users %}
* {{ user.name }}
{% else %}
No users have been found.
{% endfor %}
{% extends "layout.html" %}
{% block content %}
Content of the page...
{% endblock %}
Some examples
REST API
"require": {
"php": ">=5.3.9",
"symfony/symfony": "2.7.*",
...
...
"jms/serializer": "^1.0",
"jms/serializer-bundle": "^1.0",
"friendsofsymfony/rest-bundle": "^1.7",
"nelmio/api-doc-bundle": "^2.9"
}
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as JMS;
/**
* Account
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="AppBundle\Entity\AccountRepository")
* @JMS\ExclusionPolicy("all")
*/
class Account
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @JMS\Expose
* @JMS\Groups({"list", "single"})
*/
private $id;
/**
* @var integer
*
* @ORM\Column(name="account_number", type="integer")
* @JMS\Expose
* @JMS\Groups({"list", "single"})
*/
private $accountNumber;
/**
* @var string
*
* @ORM\Column(name="address", type="string", length=255)
* @JMS\Expose
* @JMS\Groups({"single"})
*/
private $address;
/**
* @var integer
*
* @ORM\Column(name="age", type="integer")
* @JMS\Expose
* @JMS\Groups({"single"})
*/
private $age;
/**
* @var integer
*
* @ORM\Column(name="balance", type="integer")
* @JMS\Expose
* @JMS\Groups({"list", "single"})
*/
private $balance;
/**
* @var string
*
* @ORM\Column(name="city", type="string", length=255)
* @JMS\Expose
* @JMS\Groups({"single"})
*/
private $city;
/**
* @var string
*
* @ORM\Column(name="email", type="string", length=255)
* @JMS\Expose
* @JMS\Groups({"single"})
*/
private $email;
/**
* @var string
*
* @ORM\Column(name="employer", type="string", length=255)
*/
private $employer;
/**
* @var string
*
* @ORM\Column(name="firstname", type="string", length=255)
* @JMS\Expose
* @JMS\Groups({"single"})
* @JMS\SerializedName("first_name")
*/
private $firstname;
/**
* @var string
*
* @ORM\Column(name="gender", type="string", length=1)
* @JMS\Expose
* @JMS\Groups({"single"})
*/
private $gender;
/**
* @var string
*
* @ORM\Column(name="lastname", type="string", length=255)
* @JMS\Expose
* @JMS\Groups({"single"})
*/
private $lastname;
/**
* @var string
*
* @ORM\Column(name="state", type="string", length=2)
*/
private $state;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set accountNumber
*
* @param integer $accountNumber
* @return Account
*/
public function setAccountNumber($accountNumber)
{
$this->accountNumber = $accountNumber;
return $this;
}
/**
* Get accountNumber
*
* @return integer
*/
public function getAccountNumber()
{
return $this->accountNumber;
}
/**
* Set address
*
* @param string $address
* @return Account
*/
public function setAddress($address)
{
$this->address = $address;
return $this;
}
/**
* Get address
*
* @return string
*/
public function getAddress()
{
return $this->address;
}
/**
* Set age
*
* @param integer $age
* @return Account
*/
public function setAge($age)
{
$this->age = $age;
return $this;
}
/**
* Get age
*
* @return integer
*/
public function getAge()
{
return $this->age;
}
/**
* Set balance
*
* @param integer $balance
* @return Account
*/
public function setBalance($balance)
{
$this->balance = $balance;
return $this;
}
/**
* Get balance
*
* @return integer
*/
public function getBalance()
{
return $this->balance;
}
/**
* Set city
*
* @param string $city
* @return Account
*/
public function setCity($city)
{
$this->city = $city;
return $this;
}
/**
* Get city
*
* @return string
*/
public function getCity()
{
return $this->city;
}
/**
* Set email
*
* @param string $email
* @return Account
*/
public function setEmail($email)
{
$this->email = $email;
return $this;
}
/**
* Get email
*
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* Set employer
*
* @param string $employer
* @return Account
*/
public function setEmployer($employer)
{
$this->employer = $employer;
return $this;
}
/**
* Get employer
*
* @return string
*/
public function getEmployer()
{
return $this->employer;
}
/**
* Set firstname
*
* @param string $firstname
* @return Account
*/
public function setFirstname($firstname)
{
$this->firstname = $firstname;
return $this;
}
/**
* Get firstname
*
* @return string
*/
public function getFirstname()
{
return $this->firstname;
}
/**
* Set gender
*
* @param string $gender
* @return Account
*/
public function setGender($gender)
{
$this->gender = $gender;
return $this;
}
/**
* Get gender
*
* @return string
*/
public function getGender()
{
return $this->gender;
}
/**
* Set lastname
*
* @param string $lastname
* @return Account
*/
public function setLastname($lastname)
{
$this->lastname = $lastname;
return $this;
}
/**
* Get lastname
*
* @return string
*/
public function getLastname()
{
return $this->lastname;
}
/**
* Set state
*
* @param string $state
* @return Account
*/
public function setState($state)
{
$this->state = $state;
return $this;
}
/**
* Get state
*
* @return string
*/
public function getState()
{
return $this->state;
}
}
<?php
namespace AppBundle\Controller;
use FOS\RestBundle\Controller\FOSRestController;
use JMS\Serializer\SerializationContext;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
class ApiController extends FOSRestController
{
/**
* @ApiDoc()
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function getAccountsAction()
{
$accounts = $this
->getDoctrine()
->getRepository('AppBundle:Account')
->findAll()
;
$view = $this->view($accounts);
$context = SerializationContext::create()->setGroups(array('list'));
$view->setSerializationContext($context);
return $this->handleView($view);
}
/**
* @ApiDoc()
*
* @param int $id
* @return \Symfony\Component\HttpFoundation\Response
*/
public function getAccountAction($id)
{
$account = $this
->getDoctrine()
->getRepository('AppBundle:Account')
->find($id)
;
$view = $this->view($account);
$context = SerializationContext::create()->setGroups(array('single'));
$view->setSerializationContext($context);
return $this->handleView($view);
}
}
How fast is it?
So it is slow
How to get started
http://symfony.com/