Symfony

Symfony is a set of PHP Components, a Web Application framework, a Philosophy, and a Community — all working together in harmony.

Symfony Flex

Event-driven

DDD

  • ddd-playground - Domain-Driven Design in a PHP project using Symfony

Interesting bundles

FOSRestBundle

This Bundle provides various tools to rapidly develop RESTful API’s with Symfony

Expose entity funcion result with serialized response

1
2
3
4
5
6
7
8
9
/**
*
* @VirtualProperty()
* @SerializedName("fullName")
*/
public function getName()
{
// return name;
}

Payments

Testing

  • LiipFunctionalTestBundle - Some helper classes for writing functional tests in Symfony
  • SymfonyMockerContainer - Mocker container enables you to mock services in the Symfony dependency injection container. It is particularly useful in functional tests and Behat scenarios.
  • TestDoubleBundle - A symfony bundle that eases creation of test doubles.
  • panthere - A browser testing and web crawling library for PHP and Symfony

Push notifications

HTTP Clients

Just fun

Deployment

  • DoctrineMigrationsBundle - The database migrations feature is an extension of the database abstraction layer and offers you the ability to programmatically deploy new versions of your database schema in a safe, easy and standardized way.

Doctrine

Be notified by email when a Internal Error has been occurred

Edit config_prod.yml And add this monolog configuration

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
monolog:
handlers:
# logstash:
# type: gelf
# publisher:
# hostname: %logstash_host%
# port: %logstash_port%
# formatter: monolog.formatter.gelf_message
# level: info
mail:
type: fingers_crossed
# 500 errors are logged at the critical level
action_level: critical
# to also log 400 level errors (but not 404's):
# action_level: error
# excluded_404s:
# - ^/
handler: deduplicated
deduplicated:
type: deduplication
handler: swift
swift:
type: swift_mailer
from_email: 'no-reply@your-domain'
to_email: 'alerts@your-domain'
# or list of recipients
# to_email: ['dev1@example.com', 'dev2@example.com', ...]
subject: 'An Error Occurred! %%message%%'
level: debug
formatter: monolog.formatter.html
content_type: text/html
main:
type: fingers_crossed
action_level: error
handler: nested
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
console:
type: console

OneToMany foreign key is not set

Most of the cases if due the CollectionType in Form has by_reference set to true. Just set it to false.
By references always call setWhatever to ensure the relationship is persisted propertly.

Silencing phpunit depreaction warning

Add this line in phpunit.xml

1
2
3
4
5
6
<phpunit>
<!-- ... -->
<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
</php>
</phpunit>

Comments

⬆︎TOP