This document discusses the history and current state of dependency injection (DI) in PHP. It provides an overview of DI principles and frameworks that have supported DI over the years such as Spring Framework, Symfony, and Zend Framework. The document then demonstrates how to implement DI using the Zend\Di and Symfony containers through examples of constructor injection, setter injection, interface injection and more.
The document discusses dependency injection (DI) in PHP. It provides an overview of common DI containers and frameworks used in PHP projects, including Pimple, Bucket, Zend\Di, and Symfony. For each option, it demonstrates basic usage including constructor injection, setter injection, and retrieving services from the container. It also discusses concepts like shared services, configuration via XML, and injecting dependencies via interfaces or properties. The document serves as a high-level introduction to dependency injection in PHP.
The Zend Framework is a PHP web application framework that provides modular, reusable PHP components for common web development tasks like database access, caching, session handling, and internationalization. It includes an MVC framework, database abstraction layer, authentication, and many other components. The framework is free, open source, and has over 150,000 lines of code with 90% unit test coverage. It aims to provide simple, extensible solutions to common problems in web development.
Thijs Feryn gave a presentation on the CLI (command line interface) SAPI for PHP. The CLI SAPI allows PHP scripts to be run from the command line/terminal instead of through a web server. Some key points of the CLI SAPI include reading arguments from $argv, reading input from STDIN, writing output to STDOUT, and having full control over script execution without timeouts. The CLI SAPI is useful for tasks like cronjobs, batch processing, and applications without a web frontend.
Thijs Feryn gave a presentation on the CLI SAPI at the PHPBarcelona Conference on October 28th, 2011. He discussed how the CLI SAPI allows PHP scripts to be executed from the command line interface and when it is useful, such as for cron jobs, batch tasks, daemons and more. He provided examples of passing arguments, reading from STDIN, and using functions like getopt in CLI scripts.
This document contains sample questions for the Zend Certification PHP 5 exam. It includes multiple choice questions testing PHP 5 language features and best practices related to topics like XML processing, database access, regular expressions, and security. The questions cover syntax, functions, patterns and other PHP concepts that could appear on the certification exam.
IPC2010SE Doctrine2 Enterprise Persistence Layer for PHPGuilherme Blanco
The document provides an overview of Doctrine 2, an object-relational mapper (ORM) for PHP. It discusses the key components of Doctrine 2 including Common, DBAL, and ORM. Common includes cache drivers, class loading, collections, and annotations parsing functionality. DBAL provides a database abstraction layer built on PDO and supports drivers for databases like MySQL, PostgreSQL, SQLite. ORM provides object-relational mapping functionality to map database rows to PHP objects. The document also discusses performance comparisons showing Doctrine 2 can be faster than raw PHP for certain operations like inserts due to its use of transactions.
Session held at Drupal MountainCamp 2017, Davos, Switzerland. February 17th 2017
https://drupalmountaincamp.ch/sessions/drupal-8s-multilingual-apis-building-entire-world
Are you interested in writing contributed modules, themes or distributions for Drupal 8? Then this is the session for you. In this session, we'll look at the most important APIs you would use to integrate with and best practices to use to ensure that your project is fully multilingual-ready.
This session will be valuable to all contributors even those whose projects are not inherently multilingual. Even if your project is not immediately intended to be multilingual, having a multilingual-capable module, theme or distribution makes your solution appealing to a much broader audience and is likely to provide value to global users.
Drupal 8 is a great platform to work with not only because it is so multilingual capable out-of-the-box, but also because you can easily expand while maintaining the translatability of your data. Drupal 8’s multilingual core offers a robust multilingual foundation, making the integration process much more seamless.
The majority of Drupal 8's APIs are designed to support multilingual by default and make sane assumptions about common scenarios. As a result, there are several important things to keep in mind to build the best integration possible.
In this session, we will walk through:
Working with language APIs, and the language your data is in.
Making your output strings translatable: t() and its friends, but also in twig templates
Why you should and how to code translatable content entities.
Customizing your field properties translatability so site builders can choose.
Configuration translation: translating your configuration entities
INTENDED AUDIENCE
Drupal developers working with contrib or custom modules that are designed for multilingual or non-English sites would benefit from this session (that means nearly every Drupal developer out there).
Drupal themers intending to make their theme templates translation ready.
Attendees will walk away with knowledge to add Drupal 8 multilingual support to your modules, themes and distributions.
SKILL LEVELS
This session is suitable for beginners or intermediate Drupal users. It is best if you come to the session with some exposure to OOP, Drupal 8 code and twig templates, but even if you don’t have that foundation I’m sure you can catch up.
This document contains a practice exam with 18 multiple choice questions about PHP functions and concepts. It is registered to Núria Torrescasana of Manresa, Barcelona, Spain. The questions cover topics like PHP functions, arrays, classes, sessions, strings, dates/time, and file handling. The answers to the questions are provided at the end.
This document provides information about using the PHP command line interface (CLI) SAPI. It discusses when to use the CLI SAPI, such as for cron jobs, batch tasks, daemons, and process control. It also provides examples of using the PHP binary to execute scripts from the command line, pass arguments, read from STDIN, and use options like -a for interactive mode, -r to run PHP code directly, and -i to get PHP configuration information.
This document discusses HTTP middlewares in PHP. It begins by introducing the concept of middlewares and how they allow code to be run before and after each HTTP request is handled. It then provides examples of how to implement middlewares using the Symfony HttpKernel component, including logging, caching, and authentication middlewares. Finally, it promotes a PHP middleware stack called StackPHP that provides common middlewares like sessions, OAuth, CORS, and more to simplify building middleware-based PHP applications.
Session held at DrupalCamp Ghent 2016, September 9th 2016
http://drupalcamp.be/node/161
Are you interested in writing contributed modules, themes or distributions for Drupal 8? Then this is the session for you. In this session, we'll look at the most important APIs you would use to integrate with and best practices to use to ensure that your project is fully multilingual-ready.
This session will be valuable to all contributors even those whose projects are not inherently multilingual. Even if your project is not immediately intended to be multilingual, having a multilingual-capable module, theme or distribution makes your solution appealing to a much broader audience and is likely to provide value to global users.
Drupal 8 is a great platform to work with not only because it is so multilingual capable out-of-the-box, but also because you can easily expand while maintaining the translatability of your data. Drupal 8’s multilingual core offers a robust multilingual foundation, making the integration process much more seamless.
The majority of Drupal 8's APIs are designed to support multilingual by default and make sane assumptions about common scenarios. As a result, there are several important things to keep in mind to build the best integration possible.
In this session, we will walk through:
Working with language APIs, and the language your data is in.
Making your output strings translatable: t() and its friends, but also in twig templates
Why you should and how to code translatable content entities.
Customizing your field properties translatability so site builders can choose.
Configuration translation: translating your configuration entities
INTENDED AUDIENCE
Drupal developers working with contrib or custom modules that are designed for multilingual or non-English sites would benefit from this session (that means nearly every Drupal developer out there).
Drupal themers intending to make their theme templates translation ready.
Attendees will walk away with knowledge to add Drupal 8 multilingual support to your modules, themes and distributions.
SKILL LEVELS
This session is suitable for beginners or intermediate Drupal users. It is best if you come to the session with some exposure to OOP, Drupal 8 code and twig templates, but even if you don’t have that foundation I’m sure you can catch up.
This document discusses Nette, a popular PHP framework for web development. It provides an overview of key Nette features like the RobotLoader, forms, templating with Latte, dependency injection, routing, AJAX, debugging and error handling, and the database layer. The document also mentions that components and controls allow for reusable code, signals, and flash messages.
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)ZFConf Conference
The document discusses dependency management in PHP projects. It describes existing solutions like PEAR and tools used by other languages. It then focuses on Composer, a dependency manager created specifically for PHP. Composer allows defining dependencies in a composer.json file and downloading/installing them. The document shows how to use Composer to manage dependencies for Zend Framework 2 projects and modules.
The most hated thing a developer can imageine is writing documentation but on the other hand nothing can compare with a well documented source code if you want to change or extend some code. PhpDocumentor is one of many tools enabling you to parse the inline documentation and generate well structured and referenced documents. This tallk will show you how to get the most out of phpDocumentor and shall enable you to write fantastic documentation.
PHP originated as a tool for personal home pages created by Rasmus Lerdorf. It is now known as the PHP Hypertext Processor and is an open source, scripting language commonly used for web development. PHP scripts can be embedded into HTML pages and allow for easy access to form data and output of dynamic HTML. PHP is a procedural language like C with some object-oriented features. It has an extensive function library that supports tasks like string handling, dates/times, files, databases and more. PHP follows a model where scripts run on the server and generate HTML to be sent to the client browser.
Version 1.2 of the document introduces new versions of PHP including PHP 5.6 and PHP 7. PHP 5.6 included new features like constant expressions, variadic functions, and exponentiation. PHP 7 included major performance improvements and introduced scalar type declarations, return type declarations, and new operators like the nullsafe operator and spaceship comparison operator. PHP 7 also removed alternative PHP tags and deprecated old PHP codes. Future versions of PHP will focus on additional type declarations and other new language features.
Champaign-Urbana Javascript Meetup Talk (Jan 2020)Susan Potter
Using Purescript (which transpiles to Javascript), we look at how you can build an API over HTTP by describing our endpoints using expressive types that can be deployed as a simple Node process. With this approach we try to focus our development efforts on our business domain and logic as opposed to the plumbing.
PHP is a server-side scripting language used for web development. It allows developers to add dynamic content and functionality to websites. Some key points about PHP from the document:
- PHP code is embedded into HTML and executed on the server to create dynamic web page content. It can be used to connect to databases, process forms, and more.
- PHP has many data types including strings, integers, floats, booleans, arrays, objects, null values and resources. Variables, operators, and conditional statements allow for control flow and data manipulation.
- Common PHP structures include if/else statements for conditional logic, loops like for/while/foreach for iteration, and functions for reusability. Ar
This document discusses using Zend Framework for building web applications. It describes how Zend_Application provides dependency injection and configuration without requiring objects. It also covers using Zend_Db for database access, Zend_Controller for routing, and Zend_Translate for internationalization. Validation is discussed, including using Zend_Validate with Zend_Translate to internationalize error messages.
The document discusses the SOLID principles of object-oriented design:
- The Single Responsibility Principle states that a class should have one single responsibility.
- The Open/Closed Principle states that software entities should be open for extension but closed for modification.
- The Liskov Substitution Principle states that objects should be replaceable with their subtypes without altering correctness.
- The Interface Segregation Principle states that many specific client interfaces are better than one general interface.
- The Dependency Inversion Principle states that high-level modules shouldn't depend on low-level modules but both should depend on abstractions.
PHP 7 is scheduled for release in November 2015 and will be a major new version that introduces many new features and changes. Some key points include: PHP 7 will provide improved performance through a new Zend Engine 3.0 and full support for 32-bit and 64-bit platforms. New features include scalar type declarations, return type declarations, new operators like the null coalesce operator and the spaceship operator, and anonymous classes. The release will also change some behaviors and remove deprecated features.
The document discusses the configuration of the fastcgi_param directive in the nginx fastcgi_conf file. It explains the purpose and value of each parameter line, including parameters for the script filename, query string, request method, content type, length, URI, server protocol, and more. Key variables like $document_root, $fastcgi_script_name, and $remote_addr are also described. A second section covers the mime.types file and defines common file extensions and their associated MIME types.
PHP 7 is on track, ready to hit the road later this year. What does it bring?
What other alternative do we have in the PHP World? Be from alternative implementations point of views, like hhvm or other, or do we have existing solutions to speed up PHP already? Using the existing versions?
PHP was created by Rasmus Lerdorf. Sessions allow storing temporary data across HTTP requests to offer complete transactions to visitors. Variables can be passed between pages via registering in a session, cookies, or URLs. Arrays can be counted with count() or sized with sizeof(). The move_uploaded_file() function stores uploaded files. Constructors initialize objects and destructors cleanup when objects are destroyed. Constants are defined with define() and inheritance only allows single base classes in PHP.
The document provides an overview of Symfony2 internals. It discusses the main Symfony2 components like HttpFoundation and DependencyInjection. It also covers Composer, autoloading standards like PSR-0, and how the request-response cycle works in Symfony2. The document demonstrates these concepts and also discusses how Symfony2 uses events.
This document provides an overview and agenda for a web services tutorial. It discusses consuming and building web services using PHP. The topics that will be covered include: consuming simple web services using file_get_contents, cURL, and Pecl_HTTP; building RESTful and RPC services; handling HTTP requests and responses including status codes, headers, and data formats like JSON and XML; and best practices for versioning, documentation, and statelessness. Code samples are provided on the speaker's website.
This document provides an overview of dependency injection (DI) and how it is implemented in Drupal 8. It begins by explaining DI as a design pattern that allows code to be more reusable, testable and ignorant of dependencies. It then discusses how frameworks like Symfony implement DI using a service container that is configured to inject dependencies. In Drupal 8, services are defined in YAML files and the container is configured using compiler passes. Core services can be accessed directly or by wiring classes into the container as event subscribers or using a factory method for controllers.
This document provides information about using the PHP command line interface (CLI) SAPI. It discusses when to use the CLI SAPI, such as for cron jobs, batch tasks, daemons, and process control. It also provides examples of using the PHP binary to execute scripts from the command line, pass arguments, read from STDIN, and use options like -a for interactive mode, -r to run PHP code directly, and -i to get PHP configuration information.
This document discusses HTTP middlewares in PHP. It begins by introducing the concept of middlewares and how they allow code to be run before and after each HTTP request is handled. It then provides examples of how to implement middlewares using the Symfony HttpKernel component, including logging, caching, and authentication middlewares. Finally, it promotes a PHP middleware stack called StackPHP that provides common middlewares like sessions, OAuth, CORS, and more to simplify building middleware-based PHP applications.
Session held at DrupalCamp Ghent 2016, September 9th 2016
http://drupalcamp.be/node/161
Are you interested in writing contributed modules, themes or distributions for Drupal 8? Then this is the session for you. In this session, we'll look at the most important APIs you would use to integrate with and best practices to use to ensure that your project is fully multilingual-ready.
This session will be valuable to all contributors even those whose projects are not inherently multilingual. Even if your project is not immediately intended to be multilingual, having a multilingual-capable module, theme or distribution makes your solution appealing to a much broader audience and is likely to provide value to global users.
Drupal 8 is a great platform to work with not only because it is so multilingual capable out-of-the-box, but also because you can easily expand while maintaining the translatability of your data. Drupal 8’s multilingual core offers a robust multilingual foundation, making the integration process much more seamless.
The majority of Drupal 8's APIs are designed to support multilingual by default and make sane assumptions about common scenarios. As a result, there are several important things to keep in mind to build the best integration possible.
In this session, we will walk through:
Working with language APIs, and the language your data is in.
Making your output strings translatable: t() and its friends, but also in twig templates
Why you should and how to code translatable content entities.
Customizing your field properties translatability so site builders can choose.
Configuration translation: translating your configuration entities
INTENDED AUDIENCE
Drupal developers working with contrib or custom modules that are designed for multilingual or non-English sites would benefit from this session (that means nearly every Drupal developer out there).
Drupal themers intending to make their theme templates translation ready.
Attendees will walk away with knowledge to add Drupal 8 multilingual support to your modules, themes and distributions.
SKILL LEVELS
This session is suitable for beginners or intermediate Drupal users. It is best if you come to the session with some exposure to OOP, Drupal 8 code and twig templates, but even if you don’t have that foundation I’m sure you can catch up.
This document discusses Nette, a popular PHP framework for web development. It provides an overview of key Nette features like the RobotLoader, forms, templating with Latte, dependency injection, routing, AJAX, debugging and error handling, and the database layer. The document also mentions that components and controls allow for reusable code, signals, and flash messages.
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)ZFConf Conference
The document discusses dependency management in PHP projects. It describes existing solutions like PEAR and tools used by other languages. It then focuses on Composer, a dependency manager created specifically for PHP. Composer allows defining dependencies in a composer.json file and downloading/installing them. The document shows how to use Composer to manage dependencies for Zend Framework 2 projects and modules.
The most hated thing a developer can imageine is writing documentation but on the other hand nothing can compare with a well documented source code if you want to change or extend some code. PhpDocumentor is one of many tools enabling you to parse the inline documentation and generate well structured and referenced documents. This tallk will show you how to get the most out of phpDocumentor and shall enable you to write fantastic documentation.
PHP originated as a tool for personal home pages created by Rasmus Lerdorf. It is now known as the PHP Hypertext Processor and is an open source, scripting language commonly used for web development. PHP scripts can be embedded into HTML pages and allow for easy access to form data and output of dynamic HTML. PHP is a procedural language like C with some object-oriented features. It has an extensive function library that supports tasks like string handling, dates/times, files, databases and more. PHP follows a model where scripts run on the server and generate HTML to be sent to the client browser.
Version 1.2 of the document introduces new versions of PHP including PHP 5.6 and PHP 7. PHP 5.6 included new features like constant expressions, variadic functions, and exponentiation. PHP 7 included major performance improvements and introduced scalar type declarations, return type declarations, and new operators like the nullsafe operator and spaceship comparison operator. PHP 7 also removed alternative PHP tags and deprecated old PHP codes. Future versions of PHP will focus on additional type declarations and other new language features.
Champaign-Urbana Javascript Meetup Talk (Jan 2020)Susan Potter
Using Purescript (which transpiles to Javascript), we look at how you can build an API over HTTP by describing our endpoints using expressive types that can be deployed as a simple Node process. With this approach we try to focus our development efforts on our business domain and logic as opposed to the plumbing.
PHP is a server-side scripting language used for web development. It allows developers to add dynamic content and functionality to websites. Some key points about PHP from the document:
- PHP code is embedded into HTML and executed on the server to create dynamic web page content. It can be used to connect to databases, process forms, and more.
- PHP has many data types including strings, integers, floats, booleans, arrays, objects, null values and resources. Variables, operators, and conditional statements allow for control flow and data manipulation.
- Common PHP structures include if/else statements for conditional logic, loops like for/while/foreach for iteration, and functions for reusability. Ar
This document discusses using Zend Framework for building web applications. It describes how Zend_Application provides dependency injection and configuration without requiring objects. It also covers using Zend_Db for database access, Zend_Controller for routing, and Zend_Translate for internationalization. Validation is discussed, including using Zend_Validate with Zend_Translate to internationalize error messages.
The document discusses the SOLID principles of object-oriented design:
- The Single Responsibility Principle states that a class should have one single responsibility.
- The Open/Closed Principle states that software entities should be open for extension but closed for modification.
- The Liskov Substitution Principle states that objects should be replaceable with their subtypes without altering correctness.
- The Interface Segregation Principle states that many specific client interfaces are better than one general interface.
- The Dependency Inversion Principle states that high-level modules shouldn't depend on low-level modules but both should depend on abstractions.
PHP 7 is scheduled for release in November 2015 and will be a major new version that introduces many new features and changes. Some key points include: PHP 7 will provide improved performance through a new Zend Engine 3.0 and full support for 32-bit and 64-bit platforms. New features include scalar type declarations, return type declarations, new operators like the null coalesce operator and the spaceship operator, and anonymous classes. The release will also change some behaviors and remove deprecated features.
The document discusses the configuration of the fastcgi_param directive in the nginx fastcgi_conf file. It explains the purpose and value of each parameter line, including parameters for the script filename, query string, request method, content type, length, URI, server protocol, and more. Key variables like $document_root, $fastcgi_script_name, and $remote_addr are also described. A second section covers the mime.types file and defines common file extensions and their associated MIME types.
PHP 7 is on track, ready to hit the road later this year. What does it bring?
What other alternative do we have in the PHP World? Be from alternative implementations point of views, like hhvm or other, or do we have existing solutions to speed up PHP already? Using the existing versions?
PHP was created by Rasmus Lerdorf. Sessions allow storing temporary data across HTTP requests to offer complete transactions to visitors. Variables can be passed between pages via registering in a session, cookies, or URLs. Arrays can be counted with count() or sized with sizeof(). The move_uploaded_file() function stores uploaded files. Constructors initialize objects and destructors cleanup when objects are destroyed. Constants are defined with define() and inheritance only allows single base classes in PHP.
The document provides an overview of Symfony2 internals. It discusses the main Symfony2 components like HttpFoundation and DependencyInjection. It also covers Composer, autoloading standards like PSR-0, and how the request-response cycle works in Symfony2. The document demonstrates these concepts and also discusses how Symfony2 uses events.
This document provides an overview and agenda for a web services tutorial. It discusses consuming and building web services using PHP. The topics that will be covered include: consuming simple web services using file_get_contents, cURL, and Pecl_HTTP; building RESTful and RPC services; handling HTTP requests and responses including status codes, headers, and data formats like JSON and XML; and best practices for versioning, documentation, and statelessness. Code samples are provided on the speaker's website.
This document provides an overview of dependency injection (DI) and how it is implemented in Drupal 8. It begins by explaining DI as a design pattern that allows code to be more reusable, testable and ignorant of dependencies. It then discusses how frameworks like Symfony implement DI using a service container that is configured to inject dependencies. In Drupal 8, services are defined in YAML files and the container is configured using compiler passes. Core services can be accessed directly or by wiring classes into the container as event subscribers or using a factory method for controllers.
uring the first edition of a regional event of the French PHP Community in late November 2012, Enrico Zimuel, ZF Core Team member, presented the “state of the art” of the Zend Framework 2 project. The new architecture, the new features, the performance improvement and the new classes of the 2.0 release were discussed.
Differences between ZF1 and ZF2 and how to migrate a ZF1 project to the new version is also presented.
This document provides an overview and quick start guide for Zend Framework 2. It discusses the new architecture, features and key components of ZF2, including the autoloading system, dependency injection, event manager and modular MVC. It also demonstrates how to set up a basic ZF2 application using the ZendSkeletonApplication as a starting point. The document concludes with information on migrating from ZF1 to ZF2 and getting additional help or resources.
This document provides an overview and quick start guide for Zend Framework 2. It discusses the new architecture including the autoloading system, dependency injection, event manager and MVC. It demonstrates how to set up a basic application using ZendSkeletonApplication as a starting point. The document also covers ZF2 modules, configuration, and approaches for migrating from Zend Framework 1 to Zend Framework 2.
In this talk we show the skeleton web application for Zend Framework 2. We introduce the new features of the framework, such as the new MVC layer, the Event Manager, the Dependency Injection and much more. The aim of this talk is how to start to programming using ZF2.
This talk represents the combined experience from several web development teams who have been using Symfony2 since months already to create high profile production applications. The aim is to give the audience real world advice on how to best leverage Symfony2, the current rough spots and how to work around them. Aside from covering how to implement functionality in Symfony2, this talk will also cover topics such as how to best integrate 3rd party bundles and where to find them as well as how to deploy the code and integrate into the entire server setup.
DIC To The Limit – deSymfonyDay, Barcelona 2014Ronny López
This document provides an overview of dependency injection and dependency injection containers. It discusses the problems that dependency injection aims to solve, such as having interchangeable implementations for different environments. It covers dependency inversion principles, types of dependency injection like constructor injection, and using a dependency injection container like Symfony's to automate object instantiation and wiring of dependencies. The document aims to explain how dependency injection can help decouple classes and make code more testable and reusable across different deployments.
This document provides an overview and introduction to Symfony, including:
- An overview of key Symfony components like Twig, Doctrine, and the dependency injection container.
- How to structure a Symfony application and bundle according to best practices.
- Configuring Symfony using formats like YAML and routing configuration.
- A workshop example building a blog application to demonstrate Symfony features in practice.
How Symfony changed my life (#SfPot, Paris, 19th November 2015)Matthias Noback
Before Symfony was spelled with a capital “S” there was another symfony, the first version of the framework. It already meant a lot to me at the time. But with the arrival of Symfony 2 it became clear that something very important was happening in the world of PHP programming. It appears that this framework is able to turn amateur website makers (like I used to be) into actual software developers. What is the secret? What makes Symfony so special? And why am I still hooked?
We’ll look at pieces of code, the Symfony ecosystem, the people behind it, the things that have been written about it, and the experience that I have with it. We’ll take a trip down memory lane, collecting pieces for our Symfony scrapbook, while we try to construct an answer to these questions.
This document provides an overview of key concepts for developing applications with Symfony2 including: setting up the framework, code flow, dependency injection, configuration, controllers, applications, Doctrine integration, caching, performance tips, asset management, testing, deployment, third party bundles, and resources for contributing to Symfony2. It discusses service definitions, controller choices, application choices, Doctrine examples, caching strategies, performance optimization techniques, testing approaches, deployment options, and how to work with third party bundles.
Before Symfony was spelled with a capital “S” there was another symfony, the first version of the framework. It already meant a lot to me at the time. But with the arrival of Symfony 2 it became clear that something very important was happening in the world of PHP programming. It appears that this framework is able to turn amateur website makers (like I used to be) into actual software developers. What is the secret? What makes Symfony so special? And why am I still hooked?
We’ll look at pieces of code, the Symfony ecosystem, the people behind it, the things that have been written about it, and the experience that I have with it. We’ll take a trip down memory lane, collecting pieces for our Symfony scrapbook, while we try to construct an answer to these questions.
This document summarizes a presentation about dependency injection in Drupal 8. It discusses why dependency injection is important for managing dependencies between objects and making code reusable, testable and flexible to change. It provides examples of dependency injection in Drupal 8, such as core services that are injected through the service container. It also discusses how the service container works and how services are defined to configure object relationships and dependencies.
This document summarizes Symfony 2, an evolution of Symfony 1.x that uses components like Doctrine, PHPUnit and SwiftMailer. It has the same philosophy of being full-stack, configurable and testable, but with a new foundation utilizing PHP 5.3 features. Key areas discussed include Symfony components, dependency injection, event dispatching, and using the Symfony sandbox for experimentation.
Slides from my talk during PHPCon Poland.
Szczyrk 25/10/2013
More Domain-Driven Design related content at: https://domaincentric.net/
The document discusses dependency injection (DI). It covers that DI is a design style where objects are provided with their dependencies (e.g. databases, web services) rather than constructing or obtaining dependencies themselves. Benefits of DI include making code easier to test, extend, and maintain. Costs include needing to define interfaces and configure mappings in DI containers. The document recommends DI as a best practice for decoupling code and managing dependencies.
Adding Dependency Injection to Legacy ApplicationsSam Hennessy
Dependency Injection (DI) is a fantastic technique, but what if you what to use dependency injection in your legacy application. Fear not! As someone who as done this very thing, I will show how you can successful and incrementally add DI to any application. I will present a number of recipes and solutions to common problems and give a tour of the various PHP DI projects and how they can help.
This document discusses various design patterns used in Symfony2 frameworks such as Front Controller, Decorator, Factory Method, Abstract Factory, Builder, Proxy, Mediator, Strategy, Data Mapper, Visitor, and MVC. It also discusses anti-patterns like Design for the Sake of Design, Overengineering, The Blob, Reinventing the Wheel, and Spaghetti Code. The key principles discussed are inversion of control, dependency injection, and decoupling. References for further reading on design patterns, inversion of control, and anti-patterns are also provided.
The document provides an overview of Zend Framework 2 components. It discusses the ZF2 autoloader, specifically the improvements in performance from using classmap autoloading over include path autoloading. It also covers the Zend\Di dependency injection container and how it can be used to configure object definitions and dependencies. Finally, it explains the Zend\EventManager component, describing how it implements an event-driven architecture using triggers and handlers to allow different parts of an application to interact at runtime.
This document discusses Phing, an open source build tool for PHP projects that is based on Apache Ant. It provides instructions on how to install Phing globally using PEAR or with Composer. It also covers Phing basics like projects, targets, tasks and properties. Additionally, it demonstrates how to write custom tasks in PHP and use property files to customize builds.
Offline strategies for HTML5 web applications - frOSCon8Stephan Hochdörfer
The document discusses various strategies for enabling offline functionality in HTML5 web applications. It begins by introducing the speaker and defining what is meant by "offline" in this context. It then covers application caching using the cache manifest to store static resources locally. Other techniques discussed include storing dynamic data locally using Web Storage, Web SQL Database, IndexedDB, and the File API. For each approach, examples are provided of how to perform common operations like adding, modifying and retrieving data items. The techniques are also compared in terms of advantages and disadvantages.
Offline Strategies for HTML5 Web Applications - oscon13Stephan Hochdörfer
This document discusses various strategies for enabling offline functionality in HTML5 web applications. It begins by explaining the differences between application caching and offline storage. It then covers using the application cache, web storage, web SQL database, IndexedDB, and file API for caching static resources and storing dynamic data locally. It notes pros and cons of each approach as well as browser support limitations. The document aims to help developers choose the best offline solutions for HTML5 applications.
This document discusses dependency injection (DI) and its benefits when applied in real world projects. It defines DI as a pattern that allows removal of hard-coded dependencies and makes dependencies changeable. The document explains that DI improves code reuse, testability, and maintainability by reducing tight coupling between classes. It presents different DI techniques like constructor injection and describes how to configure dependencies using annotations or XML configuration. The benefits of DI mentioned include easy unit testing, supporting multiple configurations of a class, and mocking external services.
The document discusses dependency injection, including what it is, why it is useful, and how it can be implemented. It defines dependency injection as objects receiving their dependencies from external sources rather than creating them internally. This allows for looser coupling, easier testing, and flexibility to use different implementations. The document covers different injection techniques like constructor injection and using a dependency injection container to manage object wiring.
This document discusses domain-specific languages (DSLs) and provides examples of internal and external DSLs. It explains that internal DSLs are implemented within a general-purpose language using techniques like fluent APIs, expression builders, functions, closures, and annotations. External DSLs have greater syntactic freedom but require developing a new language. Both types of DSLs aim to increase productivity by focusing on the domain rather than implementation details. The document also covers code generation from a DSL to executable code.
This document discusses various ways to install and configure Phing, the PHP build tool. It recommends installing Phing globally via PEAR or with Composer. It also covers best practices like using imports to structure targets, defining internal targets, creating custom tasks, prompting for input, and integrating Phing with Jenkins. The document emphasizes following conventions like naming the main build file build.xml and properties file build.properties.
The document discusses various strategies for enabling offline functionality in HTML5 web applications. It begins by describing past approaches like cookies, Flash cookies, and Google Gears. It then introduces the App Cache, which allows caching of static resources, and discusses some limitations. Other approaches covered include storing data locally using the Data URI scheme, Web Storage, and the Web SQL Database for structured storage. Code examples are provided for basic CRUD operations using Web Storage.
This document discusses dependency injection and its real world applications. It begins by defining what dependencies are in software applications. It then discusses that dependencies themselves are not bad, but rather fixed dependencies can be problematic. The document advocates for using dependency injection and abstraction rather than directly instantiating dependencies. It provides examples of implementing constructor, setter, and interface injection. It also discusses using annotations, external configuration files, and internal configuration for dependency injection. The benefits of dependency injection for unit testing and allowing one class to have multiple implementations are covered.
The document discusses strategies for testing code that is otherwise difficult or impossible to test directly. It presents examples of untestable code involving object construction, external resources like databases and web services, and language issues like private methods. For each problem, it proposes solutions like dependency injection, mocking dependencies, overriding language functions, and using aspects and generative programming to make code more testable. The overall message is that writing testable code requires refactoring legacy code or designing new code for testability from the start.
This document provides an overview of the Phing build tool. It discusses what Phing is, how to install Phing using PEAR or Composer, Phing basics like projects, targets, tasks and properties. It provides examples of build files that demonstrate defining multiple targets, target dependencies, calling targets programmatically, using filesets and filters. Finally, it discusses some of the things Phing can be used for, like automating permission changes.
Offline strategies for HTML5 web applications - ConFoo13Stephan Hochdörfer
The document discusses various offline strategies for HTML5 web applications, including application caching, storing data locally using web storage, web SQL databases, and IndexedDB. It provides code examples and explanations of how to cache static resources, add, modify, and remove items from local storage using these different technologies. It also highlights some advantages and disadvantages of each approach.
This document discusses strategies for testing code that is difficult or seemingly impossible to test, known as "untestable code". It provides examples of how to address issues like object construction that relies on external resources, dependencies, private methods, and language limitations. Specific techniques include using autoloading, custom stream wrappers, mocking databases/web services, reflection, and generative programming with frames to dynamically generate test and production code. The overall message is that with the right approaches, even legacy or "untestable" code can be made testable.
The document discusses various strategies for building offline capabilities in HTML5 web applications. It covers using the Application Cache manifest to cache static resources, storing data locally using Web Storage or the Web SQL Database API, and an introduction to the IndexedDB API. It also highlights some gotchas with the Application Cache, such as files always being served from the cache and the need to reload the page to see new resources.
UiPath Community Zurich: Release Management and Build PipelinesUiPathCommunity
Ensuring robust, reliable, and repeatable delivery processes is more critical than ever - it's a success factor for your automations and for automation programmes as a whole. In this session, we’ll dive into modern best practices for release management and explore how tools like the UiPathCLI can streamline your CI/CD pipelines. Whether you’re just starting with automation or scaling enterprise-grade deployments, our event promises to deliver helpful insights to you. This topic is relevant for both on-premise and cloud users - as well as for automation developers and software testers alike.
📕 Agenda:
- Best Practices for Release Management
- What it is and why it matters
- UiPath Build Pipelines Deep Dive
- Exploring CI/CD workflows, the UiPathCLI and showcasing scenarios for both on-premise and cloud
- Discussion, Q&A
👨🏫 Speakers
Roman Tobler, CEO@ Routinuum
Johans Brink, CTO@ MvR Digital Workforce
We look forward to bringing best practices and showcasing build pipelines to you - and to having interesting discussions on this important topic!
If you have any questions or inputs prior to the event, don't hesitate to reach out to us.
This event streamed live on May 27, 16:00 pm CET.
Check out all our upcoming UiPath Community sessions at:
👉 https://community.uipath.com/events/
Join UiPath Community Zurich chapter:
👉 https://community.uipath.com/zurich/
Content and eLearning Standards: Finding the Best Fit for Your-TrainingRustici Software
Tammy Rutherford, Managing Director of Rustici Software, walks through the pros and cons of different standards to better understand which standard is best for your content and chosen technologies.
Iobit Driver Booster Pro Crack Free Download [Latest] 2025Mudasir
👇👇👇👇✅✅
COPY & PASTE LINK 👉👉👉
https://pcsoftsfull.org/dl
IObit Driver Booster Pro Updating drivers is usually an initial step to avoid hardware failure, system instability, and hidden security vulnerabilities. Update drivers regularly is also an effective way to enhance your overall PC performance and maximize your gaming experience.
UiPath Community Berlin: Studio Tips & Tricks and UiPath InsightsUiPathCommunity
Join the UiPath Community Berlin (Virtual) meetup on May 27 to discover handy Studio Tips & Tricks and get introduced to UiPath Insights. Learn how to boost your development workflow, improve efficiency, and gain visibility into your automation performance.
📕 Agenda:
- Welcome & Introductions
- UiPath Studio Tips & Tricks for Efficient Development
- Best Practices for Workflow Design
- Introduction to UiPath Insights
- Creating Dashboards & Tracking KPIs (Demo)
- Q&A and Open Discussion
Perfect for developers, analysts, and automation enthusiasts!
This session streamed live on May 27, 18:00 CET.
Check out all our upcoming UiPath Community sessions at:
👉 https://community.uipath.com/events/
Join our UiPath Community Berlin chapter:
👉 https://community.uipath.com/berlin/
European Accessibility Act & Integrated Accessibility TestingJulia Undeutsch
Emma Dawson will guide you through two important topics in this session.
Firstly, she will prepare you for the European Accessibility Act (EAA), which comes into effect on 28 June 2025, and show you how development teams can prepare for it.
In the second part of the webinar, Emma Dawson will explore with you various integrated testing methods and tools that will help you improve accessibility during the development cycle, such as Linters, Storybook, Playwright, just to name a few.
Focus: European Accessibility Act, Integrated Testing tools and methods (e.g. Linters, Storybook, Playwright)
Target audience: Everyone, Developers, Testers
Adtran’s new Ensemble Cloudlet vRouter solution gives service providers a smarter way to replace aging edge routers. With virtual routing, cloud-hosted management and optional design services, the platform makes it easy to deliver high-performance Layer 3 services at lower cost. Discover how this turnkey, subscription-based solution accelerates deployment, supports hosted VNFs and helps boost enterprise ARPU.
Droidal: AI Agents Revolutionizing HealthcareDroidal LLC
Droidal’s AI Agents are transforming healthcare by bringing intelligence, speed, and efficiency to key areas such as Revenue Cycle Management (RCM), clinical operations, and patient engagement. Built specifically for the needs of U.S. hospitals and clinics, Droidal's solutions are designed to improve outcomes and reduce administrative burden.
Through simple visuals and clear examples, the presentation explains how AI Agents can support medical coding, streamline claims processing, manage denials, ensure compliance, and enhance communication between providers and patients. By integrating seamlessly with existing systems, these agents act as digital coworkers that deliver faster reimbursements, reduce errors, and enable teams to focus more on patient care.
Droidal's AI technology is more than just automation — it's a shift toward intelligent healthcare operations that are scalable, secure, and cost-effective. The presentation also offers insights into future developments in AI-driven healthcare, including how continuous learning and agent autonomy will redefine daily workflows.
Whether you're a healthcare administrator, a tech leader, or a provider looking for smarter solutions, this presentation offers a compelling overview of how Droidal’s AI Agents can help your organization achieve operational excellence and better patient outcomes.
A free demo trial is available for those interested in experiencing Droidal’s AI Agents firsthand. Our team will walk you through a live demo tailored to your specific workflows, helping you understand the immediate value and long-term impact of adopting AI in your healthcare environment.
To request a free trial or learn more:
https://droidal.com/
For those who have ever wanted to recreate classic games, this presentation covers my five-year journey to build a NES emulator in Kotlin. Starting from scratch in 2020 (you can probably guess why), I’ll share the challenges posed by the architecture of old hardware, performance optimization (surprise, surprise), and the difficulties of emulating sound. I’ll also highlight which Kotlin features shine (and why concurrency isn’t one of them). This high-level overview will walk through each step of the process—from reading ROM formats to where GPT can help, though it won’t write the code for us just yet. We’ll wrap up by launching Mario on the emulator (hopefully without a call from Nintendo).
Marko.js - Unsung Hero of Scalable Web Frameworks (DevDays 2025)Eugene Fidelin
Marko.js is an open-source JavaScript framework created by eBay back in 2014. It offers super-efficient server-side rendering, making it ideal for big e-commerce sites and other multi-page apps where speed and SEO really matter. After over 10 years of development, Marko has some standout features that make it an interesting choice. In this talk, I’ll dive into these unique features and showcase some of Marko's innovative solutions. You might not use Marko.js at your company, but there’s still a lot you can learn from it to bring to your next project.
AI Emotional Actors: “When Machines Learn to Feel and Perform"AkashKumar809858
Welcome to the era of AI Emotional Actors.
The entertainment landscape is undergoing a seismic transformation. What started as motion capture and CGI enhancements has evolved into a full-blown revolution: synthetic beings not only perform but express, emote, and adapt in real time.
For reading further follow this link -
https://akash97.gumroad.com/l/meioex
Agentic AI - The New Era of IntelligenceMuzammil Shah
This presentation is specifically designed to introduce final-year university students to the foundational principles of Agentic Artificial Intelligence (AI). It aims to provide a clear understanding of how Agentic AI systems function, their key components, and the underlying technologies that empower them. By exploring real-world applications and emerging trends, the session will equip students with essential knowledge to engage with this rapidly evolving area of AI, preparing them for further study or professional work in the field.
Supercharge Your AI Development with Local LLMsFrancesco Corti
In today's AI development landscape, developers face significant challenges when building applications that leverage powerful large language models (LLMs) through SaaS platforms like ChatGPT, Gemini, and others. While these services offer impressive capabilities, they come with substantial costs that can quickly escalate especially during the development lifecycle. Additionally, the inherent latency of web-based APIs creates frustrating bottlenecks during the critical testing and iteration phases of development, slowing down innovation and frustrating developers.
This talk will introduce the transformative approach of integrating local LLMs directly into their development environments. By bringing these models closer to where the code lives, developers can dramatically accelerate development lifecycles while maintaining complete control over model selection and configuration. This methodology effectively reduces costs to zero by eliminating dependency on pay-per-use SaaS services, while opening new possibilities for comprehensive integration testing, rapid prototyping, and specialized use cases.
Master tester AI toolbox - Kari Kakkonen at Testaus ja AI 2025 ProfessioKari Kakkonen
My slides at Professio Testaus ja AI 2025 seminar in Espoo, Finland.
Deck in English, even though I talked in Finnish this time, in addition to chairing the event.
I discuss the different motivations for testing to use AI tools to help in testing, and give several examples in each categories, some open source, some commercial.
Optimize IBM i with Consulting Services HelpAlice Gray
We offers a comprehensive overview of legacy system modernization, integration, and support services. It highlights key challenges businesses face with IBM i systems and presents tailored solutions such as modernization strategies, application development, and managed services. Ideal for IT leaders and enterprises relying on AS400, the deck includes real-world case studies, engagement models, and the benefits of expert consulting. Perfect for showcasing capabilities to clients or internal stakeholders.
DePIN = Real-World Infra + Blockchain
DePIN stands for Decentralized Physical Infrastructure Networks.
It connects physical devices to Web3 using token incentives.
How Does It Work?
Individuals contribute to infrastructure like:
Wireless networks (e.g., Helium)
Storage (e.g., Filecoin)
Sensors, compute, and energy
They earn tokens for their participation.
With Claude 4, Anthropic redefines AI capabilities, effectively unleashing a ...SOFTTECHHUB
With the introduction of Claude Opus 4 and Sonnet 4, Anthropic's newest generation of AI models is not just an incremental step but a pivotal moment, fundamentally reshaping what's possible in software development, complex problem-solving, and intelligent business automation.
In recent years, the proliferation of generative AI technology has revolutionized the landscape of media content creation, enabling even the average user to fabricate convincing videos, images, text, and audio. However, this advancement has also exacerbated the issue of online disinformation, which is spiraling out of control due to the vast reach of social media platforms, sophisticated campaigns, and the proliferation of deepfakes. After an introduction including the significant impact on key societal values such as Democracy, Public Health and Peace, the talk focuses on techniques to detect visual disinformation, manipulated photos/video, deepfakes and visuals out of context. While AI technologies offer promising avenues for addressing disinformation, it is clear that they alone are not sufficient to address this complex and multifaceted problem. Limitations of current AI approaches will be discussed, along with broader human behaviour, societal and financial challenges that must be addressed to effectively combat online disinformation. A holistic approach that encompasses technological, regulatory, and educational interventions, developing critical thought will be finally presented.
2. The state of DI in PHP
About me
Stephan Hochdörfer, bitExpert AG
Department Manager Research Labs
enjoying PHP since 1999
7 years of DI experience (in PHP)
[email protected]
@shochdoerfer
32. The state of DI in PHP
ZendDi – First steps
<?php
namespace Acme;
class TalkService {
public function __construct() {
}
public function getTalks() {
}
}
33. The state of DI in PHP
ZendDi – First steps
<?php
$di = new ZendDiDi();
$service = $di->get('AcmeTalkService');
$service->getTalks();
34. The state of DI in PHP
ZendDi – Constructor Injection
<?php
namespace Acme;
interface GenericRepository {
public function readTalks();
}
class TalkRepository implements GenericRepository {
public function readTalks() {
}
}
class TalkService {
public function __construct(TalkRepository $repo) {
}
public function getTalks() {
}
}
35. The state of DI in PHP
ZendDi – Constructor Injection
<?php
$di = new ZendDiDi();
$service = $di->get('AcmeTalkService');
$service->getTalks();
36. The state of DI in PHP
ZendDi – Setter Injection
<?php
namespace Acme;
class Logger {
public function doLog($logMsg) {
}
}
class TalkService {
public function __construct(TalkRepository $repo) {
}
public function setLogger(Logger $logger) {
}
public function getTalks() {
}
}
37. The state of DI in PHP
ZendDi – Setter Injection
<?php
$di = new ZendDiDi();
$di->configure(
new ZendDiConfiguration(
array(
'definition' => array(
'class' => array(
'AcmeTalkService' => array(
'setLogger' => array('required' => true)
)
)
)
)
)
);
$service = $di->get('AcmeTalkService');
var_dump($service);
38. The state of DI in PHP
ZendDi – Interface Injection
<?php
namespace Acme;
class Logger {
public function doLog($logMsg) {
}
}
interface LoggerAware {
public function setLogger(Logger $logger);
}
class TalkService implements LoggerAware {
public function __construct(TalkRepository $repo) {
}
public function setLogger(Logger $logger) {
}
public function getTalks() {
}
}
39. The state of DI in PHP
ZendDi – Interface Injection
<?php
$di = new ZendDiDi();
$service = $di->get('AcmeTalkService');
$service->getTalks();
40. The state of DI in PHP
ZendDi – General usage
<?php
$di = new ZendDiDi();
$service = $di->get('AcmeTalkService');
var_dump($service);
$service2 = $di->get('AcmeTalkService');
var_dump($service2); // same instance as $service
$service3 = $di->get(
'AcmeTalkService',
array(
'repo' => new phpbnl12TalkRepository()
)
);
var_dump($service3); // new instance
41. The state of DI in PHP
ZendDi – Builder Definition
<?php
// describe dependency
$dep = new ZendDiDefinitionBuilderPhpClass();
$dep->setName('AcmeTalkRepository');
// describe class
$class = new ZendDiDefinitionBuilderPhpClass();
$class->setName('AcmeTalkService');
// add injection method
$im = new ZendDiDefinitionBuilderInjectionMethod();
$im->setName('__construct');
$im->addParameter('repo', 'AcmeTalkRepository');
$class->addInjectionMethod($im);
// configure builder
$builder = new ZendDiDefinitionBuilderDefinition();
$builder->addClass($dep);
$builder->addClass($class);
42. The state of DI in PHP
ZendDi – Builder Definition
<?php
// add to Di
$defList = new ZendDiDefinitionList($builder);
$di = new ZendDiDi($defList);
$service = $di->get('AcmeTalkService');
var_dump($service);
44. The state of DI in PHP
Symfony2
<?php
namespace AcmeTalkBundleController;
use SymfonyBundleFrameworkBundleControllerController;
use SensioBundleFrameworkExtraBundleConfigurationRoute;
use SensioBundleFrameworkExtraBundleConfigurationTemplate;
class TalkController extends Controller {
/**
* @Route("/", name="_talk")
* @Template()
*/
public function indexAction() {
$service = $this->get('acme.talk.service');
return array();
}
}
45. The state of DI in PHP
Symfony2 – Configuration file
File services.xml in src/Acme/DemoBundle/Resources/config
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
</container>
46. The state of DI in PHP
Symfony2 – Constructor Injection
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="acme.talk.repo"
class="AcmeTalkBundleServiceTalkRepository" />
<service id="acme.talk.service"
class="AcmeTalkBundleServiceTalkService">
<argument type="service" id="acme.talk.repo" />
</service>
</services>
</container>
47. The state of DI in PHP
Symfony2 – Setter Injection
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="acme.talk.logger"
class="AcmeTalkBundleServiceLogger" />
<service id="acme.talk.repo"
class="AcmeTalkBundleServiceTalkRepository" />
<service id="acme.talk.service"
class="AcmeTalkBundleServiceTalkService">
<argument type="service" id="acme.talk.repo" />
<call method="setLogger">
<argument type="service" id="acme.talk.logger" />
</call>
</service>
</services>
</container>
48. The state of DI in PHP
Symfony2 – Setter Injection (optional)
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="acme.talk.logger"
class="AcmeTalkBundleServiceLogger" />
<service id="acme.talk.repo"
class="AcmeTalkBundleServiceTalkRepository" />
<service id="acme.talk.service"
class="AcmeTalkBundleServiceTalkService">
<argument type="service" id="acme.talk.repo" />
<call method="setLogger">
<argument type="service" id="acme.talk.logger"
on-invalid="ignore" />
</call>
</service>
</services>
</container>
49. The state of DI in PHP
Symfony2 – Property Injection
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="acme.talk.repo"
class="AcmeTalkBundleServiceTalkRepository" />
<service id="acme.talk.service"
class="AcmeTalkBundleServiceTalkService">
<property name="talkRepository" type="service"
id="acme.talk.repo" />
</service>
</services>
</container>
50. The state of DI in PHP
Symfony2 – private/public Services
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="acme.talk.logger"
class="AcmeTalkBundleServiceLogger" public="false" />
<service id="acme.talk.repo"
class="AcmeTalkBundleServiceTalkRepository" />
<service id="acme.talk.service"
class="AcmeTalkBundleServiceTalkService">
<argument type="service" id="acme.talk.repo" />
<call method="setLogger">
<argument type="service" id="acme.talk.logger" />
</call>
</service>
</services>
</container>
51. The state of DI in PHP
Symfony2 – Service inheritance
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="acme.talk.serviceparent"
class="AcmeTalkBundleServiceTalkService" abstract="true">
<property name="talkRepository" type="service"
id="acme.talk.repo" />
</service>
<service id="acme.talk.service" parent="acme.talk.serviceparent" />
<service id="acme.talk.service2" parent="acme.talk.serviceparent" />
</services>
</container>
52. The state of DI in PHP
Symfony2 – Service scoping
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="acme.talk.repo"
class="AcmeTalkBundleServiceTalkRepository" />
<service id="acme.talk.service"
class="AcmeTalkBundleServiceTalkService" scope="prototype">
<property name="talkRepository" type="service"
id="acme.talk.repo" />
</service>
</services>
</container>
54. The state of DI in PHP
Flow3 – Constructor Injection
<?php
namespace AcmeDemoController;
use TYPO3FLOW3Annotations as FLOW3;
/**
* @FLOW3Scope("session")
*/
class StandardController extends TYPO3FLOW3MVCControllerActionController {
/**
* @var AcmeDemoServiceTalkServiceInterface
*/
protected $talkService;
public function __construct(
AcmeDemoServiceTalkService $talkService) {
$this->talkService = $talkService;
}
public function indexAction() {
}
}
55. The state of DI in PHP
Flow3 – Constructor Injection (manually)
<?php
namespace AcmeDemoController;
use TYPO3FLOW3Annotations as FLOW3;
/**
* @FLOW3Scope("session")
*/
class StandardController extends TYPO3FLOW3MVCControllerActionController {
/**
* @var AcmeDemoServiceTalkServiceInterface
*/
protected $talkService;
public function __construct(
AcmeDemoServiceTalkService $talkService) {
$this->talkService = $talkService;
}
public function indexAction() {
}
}
56. The state of DI in PHP
Flow3 – Setter Injection (manually)
<?php
namespace AcmeDemoController;
use TYPO3FLOW3Annotations as FLOW3;
/**
* @FLOW3Scope("session")
*/
class StandardController extends TYPO3FLOW3MVCControllerActionController {
/**
* @var AcmeDemoServiceTalkServiceInterface
*/
protected $talkService;
public function setTalkService(
AcmeDemoServiceTalkService $talkService) {
$this->talkService = $talkService;
}
public function indexAction() {
}
}
57. The state of DI in PHP
Flow3 – Setter Injection (manually)
File Objects.yaml in Packages/Application/Acme.Demo/Configuration
# @package Acme
AcmeDemoControllerStandardController:
properties:
talkService:
object: AcmeDemoServiceTalkService
58. The state of DI in PHP
Flow3 – Setter Injection (Automagic)
<?php
namespace AcmeDemoController;
use TYPO3FLOW3Annotations as FLOW3;
/**
* @FLOW3Scope("session")
*/
class StandardController extends TYPO3FLOW3MVCControllerActionController {
/**
* @var AcmeDemoServiceTalkServiceInterface
*/
protected $talkService;
public function injectTalkService(
AcmeDemoServiceTalkService $talkService) {
$this->talkService = $talkService;
}
public function indexAction() {
}
}
59. The state of DI in PHP
Flow3 – Setter Injection (Automagic)
<?php
namespace AcmeDemoController;
use TYPO3FLOW3Annotations as FLOW3;
/**
* @FLOW3Scope("session")
*/
class StandardController extends TYPO3FLOW3MVCControllerActionController {
/**
* @var AcmeDemoServiceTalkServiceInterface
*/
protected $talkService;
public function injectSomethingElse(
AcmeDemoServiceTalkService $talkService) {
$this->talkService = $talkService;
}
public function indexAction() {
}
}
60. The state of DI in PHP
Flow3 – Property Injection
<?php
namespace AcmeDemoController;
use TYPO3FLOW3Annotations as FLOW3;
/**
* @FLOW3Scope("session")
*/
class StandardController extends TYPO3FLOW3MVCControllerActionController {
/**
* @var AcmeDemoServiceTalkService
* @FLOW3Inject
*/
protected $talkService;
public function indexAction() {
}
}
61. The state of DI in PHP
Flow3 – Property Injection (with Interface)
<?php
namespace AcmeDemoController;
use TYPO3FLOW3Annotations as FLOW3;
/**
* @FLOW3Scope("session")
*/
class StandardController extends TYPO3FLOW3MVCControllerActionController {
/**
* @var AcmeDemoServiceTalkServiceInterface
* @FLOW3Inject
*/
protected $talkService;
public function indexAction() {
}
}
62. The state of DI in PHP
Flow3 – Property Injection (with Interface)
File Objects.yaml in Packages/Application/Acme.Demo/Configuration
# @package Acme
AcmeDemoServiceTalkServiceInterface:
className: 'AcmeDemoServiceTalkService'
63. The state of DI in PHP
Flow3 – Scoping
<?php
namespace AcmeDemoController;
use TYPO3FLOW3Annotations as FLOW3;
/**
* @FLOW3Scope("session")
*/
class StandardController extends TYPO3FLOW3MVCControllerActionController {
/**
* @var AcmeDemoServiceTalkServiceInterface
* @FLOW3Inject
*/
protected $talkService;
public function indexAction() {
}
}