Groovy Domain Specific Languages - SpringOne2GX 2012Guillaume Laforge
Paul King, Andrew Eisenberg and Guillaume Laforge present about implementation of Domain-Specific Languages in Groovy, while at the SpringOne2GX 2012 conference in Washington DC.
Rails Antipatterns (http://www.amazon.com/Rails-AntiPatterns-Refactoring-Addison-Wesley-Professional/dp/0321604814) 를 읽고 몇 가지 정도만 요약을 해보았습니다.
레일즈를 시작한지 얼마 되지 않은터라 맞지 않는 부분이 있더라도 양해 부탁드려요 :)
EWD 3 Training Course Part 5b: First Steps in Building a QEWD ApplicationRob Tweed
This presentation is part 5 in the EWD 3 Training Course. It describes the first steps you should take when building a browser-based desktop QEWD application. This version of Part 5 is for anyone using QEWD on Linux or a Raspberry Pi.
Slide links:
- https://lumberjack.rareloop.com
- https://docs.lumberjack.rareloop.com
- https://github.com/Rareloop/lumberjack-bedrock-installer
- https://github.com/Rareloop/lumberjack
- https://github.com/Rareloop/lumberjack-validation
- https://github.com/Rareloop/hatchet
- https://lizkeogh.com/2017/08/31/reflecting-reality/amp
- https://www.upstatement.com/timber
- https://roots.io/bedrock
- https://scotch.io/bar-talk/s-o-l-i-d-the-first-five-principles-of-object-oriented-design
- https://github.com/zendframework/zend-diactoros
- https://www.php-fig.org
- http://php-di.org
---
Often WordPress themes are not easy to change, maintain or fun to work on. This can rule WordPress out as a viable option for bespoke, non-trivial websites.
In this talk we’ll dive into how this happens & look at how we can benefit from software engineering techniques to help make your code easier to change. I’ll also show how using Lumberjack, a powerful MVC framework built on Timber, can be used to power-up your themes.
EWD 3 Training Course Part 5a: First Steps in Building a QEWD ApplicationRob Tweed
This presentation is part 5 in the EWD 3 Training Course. It describes the first steps you should take when building a browser-based desktop QEWD application. This version of Part 5 is for anyone using QEWD on Windows with the Cache database.
Using php as a server-side scripting language, I have created a simple user authentication module. The module can be directly implemented in a website with some minor changes to provide user signup ability in a webpage. HTML and CSS have been used for the designing of the webpage, and MySQL for backend database management.
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)James Titcumb
You've heard of Zend's new framework, Expressive, and you've heard it's the new hotness. In this talk, I will introduce the concepts of Expressive, how to bootstrap a simple application with the framework using best practices, and finally how to integrate a third party tool like Doctrine ORM.
There are a lot of tools available that can make developers life easier. Zend Server is one of them. The Zend products have come from a long way, but since the introduction of Zend Server the focus is more on a developers perspective than ever. The integrated tools make debugging, performance tuning, process offloading and deployment really accessible. Even extending it with your own needs is possible nowadays. The current PHP ecosystem gives every developer enormous amounts of power in creating applications without writing a lot of code.
In this talk I will show you how Zend Server can help you understand your own PHP application better, by using its tools to open the blackbox that your PHP application really is. This talk is not about selling Zend Server, but helping developers understand why reconsidering your development stack is always an option. Because in the end every developer likes to be a lazy developer.
Kicking off with Zend Expressive and Doctrine ORM (PHP South Africa 2018)James Titcumb
You've heard of Zend's new framework, Expressive, and you've heard it's the new hotness. In this talk, I will introduce the concepts of Expressive, how to bootstrap a simple application with the framework using best practices, and finally how to integrate a third party tool like Doctrine ORM.
Groovy Domain Specific Languages - SpringOne2GX 2012Guillaume Laforge
Paul King, Andrew Eisenberg and Guillaume Laforge present about implementation of Domain-Specific Languages in Groovy, while at the SpringOne2GX 2012 conference in Washington DC.
Rails Antipatterns (http://www.amazon.com/Rails-AntiPatterns-Refactoring-Addison-Wesley-Professional/dp/0321604814) 를 읽고 몇 가지 정도만 요약을 해보았습니다.
레일즈를 시작한지 얼마 되지 않은터라 맞지 않는 부분이 있더라도 양해 부탁드려요 :)
EWD 3 Training Course Part 5b: First Steps in Building a QEWD ApplicationRob Tweed
This presentation is part 5 in the EWD 3 Training Course. It describes the first steps you should take when building a browser-based desktop QEWD application. This version of Part 5 is for anyone using QEWD on Linux or a Raspberry Pi.
Slide links:
- https://lumberjack.rareloop.com
- https://docs.lumberjack.rareloop.com
- https://github.com/Rareloop/lumberjack-bedrock-installer
- https://github.com/Rareloop/lumberjack
- https://github.com/Rareloop/lumberjack-validation
- https://github.com/Rareloop/hatchet
- https://lizkeogh.com/2017/08/31/reflecting-reality/amp
- https://www.upstatement.com/timber
- https://roots.io/bedrock
- https://scotch.io/bar-talk/s-o-l-i-d-the-first-five-principles-of-object-oriented-design
- https://github.com/zendframework/zend-diactoros
- https://www.php-fig.org
- http://php-di.org
---
Often WordPress themes are not easy to change, maintain or fun to work on. This can rule WordPress out as a viable option for bespoke, non-trivial websites.
In this talk we’ll dive into how this happens & look at how we can benefit from software engineering techniques to help make your code easier to change. I’ll also show how using Lumberjack, a powerful MVC framework built on Timber, can be used to power-up your themes.
EWD 3 Training Course Part 5a: First Steps in Building a QEWD ApplicationRob Tweed
This presentation is part 5 in the EWD 3 Training Course. It describes the first steps you should take when building a browser-based desktop QEWD application. This version of Part 5 is for anyone using QEWD on Windows with the Cache database.
Using php as a server-side scripting language, I have created a simple user authentication module. The module can be directly implemented in a website with some minor changes to provide user signup ability in a webpage. HTML and CSS have been used for the designing of the webpage, and MySQL for backend database management.
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)James Titcumb
You've heard of Zend's new framework, Expressive, and you've heard it's the new hotness. In this talk, I will introduce the concepts of Expressive, how to bootstrap a simple application with the framework using best practices, and finally how to integrate a third party tool like Doctrine ORM.
There are a lot of tools available that can make developers life easier. Zend Server is one of them. The Zend products have come from a long way, but since the introduction of Zend Server the focus is more on a developers perspective than ever. The integrated tools make debugging, performance tuning, process offloading and deployment really accessible. Even extending it with your own needs is possible nowadays. The current PHP ecosystem gives every developer enormous amounts of power in creating applications without writing a lot of code.
In this talk I will show you how Zend Server can help you understand your own PHP application better, by using its tools to open the blackbox that your PHP application really is. This talk is not about selling Zend Server, but helping developers understand why reconsidering your development stack is always an option. Because in the end every developer likes to be a lazy developer.
Kicking off with Zend Expressive and Doctrine ORM (PHP South Africa 2018)James Titcumb
You've heard of Zend's new framework, Expressive, and you've heard it's the new hotness. In this talk, I will introduce the concepts of Expressive, how to bootstrap a simple application with the framework using best practices, and finally how to integrate a third party tool like Doctrine ORM.
Kicking off with Zend Expressive and Doctrine ORM (ConFoo YVR 2017)James Titcumb
You've heard of Zend's new framework, Expressive, and you've heard it's the new hotness. In this talk, I will introduce the concepts of Expressive, how to bootstrap a simple application with the framework using best practices, and finally how to integrate a third party tool like Doctrine ORM.
Given at zendcon 2008 - my very first conference talk. And I did it way too fast. A lot of the information about these extensions is surprisingly relevant.
Everyone talks about raising the bar on the quality of code, but it’s hard to implement when you have no clue where to start. This talk is geared toward all levels of developers, and will teach you how to improve by using the right tools effectively – a must-attend for any PHP developer who wants to scale up their quality.
Michelangelo will tell us about Quality Assurance for PHP in general and show how different QA-related actions can be performed using PhpStorm IDE. The webinar will cover topics including:
Revision control
Syntax checking
Code documentation
Unit Testing with PHPUnit
Measuring code health with a variety of tools
Profiling and debugging with Xdebug
Automation with Phing
Team work and more.
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)James Titcumb
You've heard of the new Zend framework, Expressive, and you've heard it's the new hotness. In this talk, I will introduce the concepts of Expressive, how to bootstrap a simple application with the framework using best practices, and how to integrate a third party tool like Doctrine ORM.
Kicking off with Zend Expressive and Doctrine ORM (PHP MiNDS March 2018)James Titcumb
You've heard of Zend's new framework, Expressive, and you've heard it's the new hotness. In this talk, I will introduce the concepts of Expressive, how to bootstrap a simple application with the framework using best practices, and finally how to integrate a third party tool like Doctrine ORM.
Similar to Zend Framework Components for non-framework Development (20)
Best Practices in PHP Application DeploymentShahar Evron
An overview of the challenges in managing the web application development lifecycle and how a correct deployment system can help. A few common deployment techniques are reviewed. In addition, some info on an upcoming Zend Server deployment feature.
A presentation given by Roy Ganor and myself at local Microsoft PHP developer day in Microsoft Israel, covering some general Zend info, Zend Framework, some Zend Studio and a bit about Windows Azure. The talk also included a lot of live demo and code review
This presentation overviews the different features in Zend Server 5.0, including performance features, application level monitoring for PHP, Job Queueing for PHP and the new production code tracing feature
Presented at ZendCon 09
Zend Server provides a host of features that can help you improve your PHP application's performance and scalability.
In this presentation, presented at ZendCon 09, we overview them and how and where to use what
Scaling PHP Applications with Zend PlatformShahar Evron
An overview of Zend Platform - Zend\'s enterprise grade runtime environment for PHP, and how it helps users scale their PHP applications. The presentation overviews the main features of Zend Platform: PHP Intelligence, Performance, Session Clustering and Job Queues.
Content Indexing with Zend_Search_LuceneShahar Evron
Zend_Search_Lucene is the first PHP port of the Lucene search and indexing library. A component of the Zend Framework, it allows you to easily index and search full-text indexes in better performance than many other solutions.
The slides are a technical intro and basic tutorial to Zend_Search_Lucene. They were presented by me at several PHP conferences, including Zend/PHP Conferece 2007 at San Francisco CA, and International PHP Conference Spring Edition 2007 in Stuttgart, Germany.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfPaige Cruz
Monitoring and observability aren’t traditionally found in software curriculums and many of us cobble this knowledge together from whatever vendor or ecosystem we were first introduced to and whatever is a part of your current company’s observability stack.
While the dev and ops silo continues to crumble….many organizations still relegate monitoring & observability as the purview of ops, infra and SRE teams. This is a mistake - achieving a highly observable system requires collaboration up and down the stack.
I, a former op, would like to extend an invitation to all application developers to join the observability party will share these foundational concepts to build on:
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfPeter Spielvogel
Building better applications for business users with SAP Fiori.
• What is SAP Fiori and why it matters to you
• How a better user experience drives measurable business benefits
• How to get started with SAP Fiori today
• How SAP Fiori elements accelerates application development
• How SAP Build Code includes SAP Fiori tools and other generative artificial intelligence capabilities
• How SAP Fiori paves the way for using AI in SAP apps
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
A tale of scale & speed: How the US Navy is enabling software delivery from l...
Zend Framework Components for non-framework Development
1. Shahar Evron | Zend Technologies
Zend Framework Components
...for non-framework development
2. Agenda
• Zend Framework's „Use At Will“ approach
• So why would I want to use Zend Framework?
• Show Us The Code! (the interesting part)
○ Zend_Mail
○ Zend_Db
○ Zend_Config
○ Zend_Http_Client
○ Zend_Service
○ Zend_Json
○ Zend_Log
• Some other things worth looking at
Shahar Evron | Zend Technologies 2
3. Prologue
• Who Are You?
○ PHP Programmers / Users?
○ Using Zend Framework?
○ Using other PHP Frameworks?
○ Using PEAR classes in your code?
○ Tend to reuse other people's code?
Shahar Evron | Zend Technologies 3
4. Prologue
• Who am I?
○ Programming in PHP for ~6 years
○ Working for Zend for the last 3 years
▪ Services, Product Management
○ Part-time contributor to ZF
▪ Not a part of my actual job ;-)
○ If you have a hard time with my name:
▪ German: Shachar
▪ Spanish: Shajar
▪ Russian: Шахар
▪ Arabic: ﺷﺨﺮ
▪ Hebrew: שחר
ַ ָ
Shahar Evron | Zend Technologies 4
6. Fire At Will!
• Zend Framework embraces a use-at-will philosophy
• In practice, this means we try to have little or no
dependencies between components
○ You don't have to use the entire framework
○ You don't have to build your application in a particular way
○ ...But if you want to, you can!
• There are some components (mostly the MVC stuff)
that have loose bindings to other components
• Many components have very little dependencies, and
can simply be included and used in any application
Shahar Evron | Zend Technologies 6
8. If No Framework, Why Zend Framework?
• Because it's high quality
○ Strict standards from day one
○ Unit Tested (80%+ code coverage)
○ Used and reviewed by a large community of users
• Because it's clean IP and friendly licensed
• Because it's there!
○ Well, it's one good option – you have others of course ;)
Shahar Evron | Zend Technologies 8
11. Zend_Mail
• Allows you to easily compose and send e-mail
messages from your PHP applications
• Simplified control over recipients, headers, etc.
• Easy creation of multipart/alternative HTML
messages
• Easy attachment handling
• Supports different delivery transports
• Allows you to read e-mail messages from POP3,
IMAP, Mbox and Maildir (not discussed here)
Shahar Evron | Zend Technologies 11
12. Zend_Mail
Sending a simple message through Zend_Mail:
// Load the Zend_Mail class
require_once 'Zend/Mail.php';
// Instantiate a new message object
$message = new Zend_Mail('utf-8');
// Use the fluent interface to set message properties
$message->setFrom('shahar.e@zend.com', 'Shahar E')
->setSubject('Hello, world!')
->setBodyText(quot;Hi, what's up?quot;)
->addHeader('Importance', 'high')
->addTo('someone@example.com', 'Some One')
->addCc('other.guy@example.com', 'Other Guy')
->addBcc('t.person@example.com', 'The Third Person');
// Send the message!
$message->send();
Shahar Evron | Zend Technologies 12
13. Zend_Mail
Creating multipart/alternative messages
// ...Load the Zend_Mail and prepare the message object as before...
$text = <<<WELCOME_MSG
Hello Shahar,
*Thank you* for registering to my new site.
You are welcome to log in at http://example.com/log-in
The example.com team!
WELCOME_MSG;
// Set the plain text and HTML body parts
$message->setBodyText($text);
$message->setBodyHtml(nl2br(preg_replace(
array('/*(.+?)*/', '|https?://S+|'),
array('<strong>1</strong>', '<a href=quot;0quot;>0</a>'),
$text)));
// Send the message!
$message->send();
Shahar Evron | Zend Technologies 13
14. Zend_Mail
Creating multipart/alternative messages - result:
Subject: Hello, world!
From: quot;Shahar Equot; <shahar.e@zend.com>
Importance: high
Content-Type: multipart/alternative; charset=quot;utf8quot;;
boundary=quot;=_96d67bd80a67ddc3fa0d70097a48504equot;
MIME-Version: 1.0
--=_96d67bd80a67ddc3fa0d70097a48504e
Content-Type: text/plain; charset=quot;utf8quot;
Content-Transfer-Encoding: quoted-printable
Hello Shahar,=0A=0A*Thank you* for registering to my new site. =0AYou are=
welcome to log in at http://example.com/log-in=0A=0AThe example.com team!
--=_96d67bd80a67ddc3fa0d70097a48504e
Content-Type: text/html; charset=quot;utf8quot;
Content-Transfer-Encoding: quoted-printable
Hello Shahar,<br />=0A<br />=0A<strong>Thank you</strong> for registering=
to my new site. <br />=0AYou are welcome to log in at <a href=3Dquot;http://e=
xample.com/log-inquot;>http://example.com/log-in</a><br />=0A<br />=0AThe exam=
ple.com team!
--=_96d67bd80a67ddc3fa0d70097a48504e--
Shahar Evron | Zend Technologies 14
15. Zend_Mail
Attaching files
// Load the Zend_Mail class
require_once 'Zend/Mail.php';
// Instantiate a new message object
$message = new Zend_Mail('utf-8');
// Use the fluent interface to set message properties
$message->setFrom('spammer@example.com', 'Spammer Dude')
->setSubject('The report you have requested is ready')
->addTo('shahar@localhost', 'Shahar Evron');
// Add a PDF attachment (Will be base64 encoded)
$pdf = $message->createAttachment(file_get_contents('report.pdf'));
$pdf->type = 'application/pdf';
$pdf->filename = 'report.pdf';
// ... Continued on next slide ...
Shahar Evron | Zend Technologies 15
16. Zend_Mail
Attaching files (contd.)
// Add a logo to the message - referenced from the message HTML body
$img = $message->createAttachment(file_get_contents('logo.png'));
$img->type = 'image/png';
$img->id = 'logo-image-png@example.com';
$img->filename = 'logo.png';
$img->disposition = Zend_Mime::DISPOSITION_INLINE;
// Set the message body
$message->setBodyHtml(
quot;Hello Shahar,<br /><br />quot; .
quot;The report you have requested is attached as a PDF file.<br /><br />quot; .
quot;Enjoy!<br />quot; .
'<img src=quot;cid:logo-image-png@example.comquot; alt=quot;Example.com Logoquot; />'
);
// Set the message MIME-type to multipart/related
$message->setType(Zend_Mime::MULTIPART_RELATED);
// Send the message!
$message->send();
Shahar Evron | Zend Technologies 16
18. Zend_Mail
Sending multiple e-mails efficiently
○ Using the PHP mail() function is bad for multiple e-mails
○ On each mail you send, you:
▪ Fork a sendmail process
▪ sendmail will open a connection to the SMTP server, send the
message and close the connection
▪ The sendmail process is then closed
○ This is why Zend_Mail provides the SMTP transport
▪ A full implementation of an SMTP client in PHP
▪ Allows you to open a connection once and reuse it to send several
messages
▪ No forking is needed, does not depend on sendmail
Shahar Evron | Zend Technologies 18
19. Zend_Mail
Sending multiple e-mails efficiently
// Load the Zend_Mail and Zend_Mail_Transport_Smtp classes
require_once 'Zend/Mail.php';
require_once 'Zend/Mail/Transport/Smtp.php';
// Set up a transport using smtp.example.com as SMTP server
$smtpConn = new Zend_Mail_Transport_Smtp('smtp.example.com');
// ... $msg1, $msg2 and $msg3 are Zend_Mail message objects
// Send a bunch of e-mail messages
$msg1->send($smtpConn);
$msg2->send($smtpConn);
$msg3->send($smtpConn);
Shahar Evron | Zend Technologies 19
20. Zend_Db_Adapter
Zend_Db_Select
Shahar Evron | Zend Technologies 20
21. Zend_Db_Adapter and Zend_Db_Select
• Zend_Db_Adapter provides an abstract, vendor-
agnostic RDBMS connection layer
○ Mostly similar in concept and in interface to PDO
○ Actually, it will usually use PDO under the hood
○ But can also use other PHP RDBMS client extensions
○ It also provides some convenience methods for escaping
and running queries
• Zend_Db_Select provides even better vendor-
independence by abstracting SELECT SQL queries
○ This means you (almost) don't have to write any SQL code!
Shahar Evron | Zend Technologies 21
22. Zend_Db_Adapter
Connecting to a MySQL database using the factory method
require_once 'Zend/Db.php';
// Connecting to MySQL through MySQLi
$config = array(
'adapter' => 'MYSQLI',
'hostname' => 'localhost',
'dbname' => 'wiki_db',
'username' => 'wiki_db_user',
'password' => 'xxxxxx'
);
// Use the factory method to connect to the DB
$db = Zend_Db::factory($config['adapter'], $config);
Shahar Evron | Zend Technologies 22
23. Zend_Db_Adapter
Connecting to an SQLite DB and inserting some data
// Same connect method – but this time to SQLite 3.x
$config = array(
'adapter' => 'PDO_SQLITE',
'dbname' => 'var/data/dbfile.sq3'
);
$db = Zend_Db::factory($config['adapter'], $config);
// Insert a new row to the articles table
$db->insert('articles', array(
'created_by' => (int) $user_id,
'created_at' => $_SERVER['REQUEST_TIME'],
'title' => $_POST['title'],
'content' => $_POST['content']
));
Shahar Evron | Zend Technologies 23
24. Zend_Db_Select
Fetching data from the DB using Zend_Db_Select
// Create the SELECT query
$select = $db->select()
->from('articles', array('id', 'title'))
->join('users', 'articles.author = users.id',
array('name', 'email'))
->where('links_to', 5)
->order('articles.title')
->limit(16);
// Execute the query, return a result set object
$results = $select->query();
--- Produced SQL query: ---
SELECT quot;articlesquot;.quot;idquot;, quot;articlesquot;.quot;titlequot;, quot;usersquot;.quot;namequot;,
quot;usersquot;.quot;emailquot; FROM quot;articlesquot; INNER JOIN quot;usersquot; ON articles.author =
users.id WHERE (links_to = 5) ORDER BY quot;articlesquot;.quot;titlequot; ASC LIMIT 16
Shahar Evron | Zend Technologies 24
26. Zend_Config
• The purpose of Zend_Config is to allow easy
management of and access to configuration data
• Several configuration storage formats are supported
○ Native PHP arrays
○ INI or XML files
○ Adding support for other formats is easy!
• Supports some cool features as well
○ Nesting configuration
○ Inheritance between configuration sections
○ Default values
Shahar Evron | Zend Technologies 26
27. Zend_Config
Sample INI file used in next slide (config.ini)
[ production ]
debug = Off
path.web.root = /
path.web.host = example.com
db.adapter = MYSQLI
db.hostname = 10.1.2.3
db.username = produser
db.password = xxxxxxxx
db.dbname = wikidb
[ development : production ]
debug = On
path.web.host = dev.example.com
db.adapter = PDO_SQLITE
db.dbname = wikidb.sq3
Shahar Evron | Zend Technologies 27
28. Zend_Config
Using Zend_Config_Ini to manage configuration data
$env = getenv('MYAPP_ENVIRONMENT');
if (! $env) $env = 'production';
// Load configuration data from file
$cfg = new Zend_Config_Ini('config.ini', $env);
// Connect to DB using our configuration settings
$db = Zend_Db::factory($cfg->db->adapter, $cfg->db->toArray());
// Will always print '/' regardless of environment
echo $cfg->path->web->root;
// Will be true or false - depending on environment
var_dump($cfg->debug);
// Fetching with default value
$hostname = $cfg->path->web->get('host', $_SERVER['HOST_NAME']);
Shahar Evron | Zend Technologies 28
30. Zend_Http_Client
• A PHP-implemented HTTP client
○ Can be used to pass data around using HTTP
○ Serves as the basis for web-service client components in ZF
• Does not require any extensions (CURL, pecl_http)
• Does not require allow_url_fopen
• Supports some advanced HTTP features
○ Cookie persistence
○ File uploads
○ Proxy, authentication, HTTPS over proxy
Shahar Evron | Zend Technologies 30
31. Zend_Http_Client
Reusing cookies over consecutive requests
// Set up the client and enable cookie persistance
$client = new Zend_Http_Client('https://www.example.com/user/login');
$client->setCookieJar();
// Set the login parameters
$client->setParameterPost(array(
'username' => 'shahar.e',
'password' => 'xxxxxxxxx'
));
// Send a POST request
$response = $client->request(Zend_Http_Client::POST);
// Send a GET request to fetch the restricted content
$client->resetParameters();
$client->setUri('http://www.example.com/restricted');
$response = $client->request(Zend_Http_Client::GET);
Shahar Evron | Zend Technologies 31
32. Zend_Http_Client
Sending files over HTTP using POST file upload
// Set up the client and enable cookie persistance
$client = new Zend_Http_Client('http://www.example.com/upload-photo');
// Add a file from disk
$client->setFileUpload('/home/shahar/photos/image1.jpg', 'photo1');
// Add a file from buffer
$client->setFileUpload('mock-file.jpg', 'photo2', $image_data,
'image/jpg');
// Send files
$response = $client->request();
// Files will be available on server-side PHP as
// $_FILES['photo1'] and $_FILES['photo2']
Shahar Evron | Zend Technologies 32
34. Zend_Service
• Zend Framework aims to provide easy-to-use web
service clients for many web service providers
○ Yahoo!
○ Flickr
○ AudioScrobbler
○ Amazon
○ ...and many others
• New service clients are added on every release
• There are also the Gdata and Infocard clients
• There are also generic REST and XMLRPC clients
Shahar Evron | Zend Technologies 34
36. Zend_Service_Akismet
Checking a blog post comment for spam using Akismet
require_once 'Zend/Service/Akismet.php';
// Create the client object using the API key and blog URL
// Get your API key from http://akismet.com/ (free for personal use)
$akismet = new Zend_Service_Akismet($apiKey, 'http://example.com/blog');
// Check a blog post comment for spam
$commentData = array(
'user_ip' => $_SERVER['REMOTE_ADDR'],
'user_agent' => $_SERVER['HTTP_USER_AGENT'],
'comment_type' => 'trackback',
'comment_author' => 'Honest Bender',
'comment_email' => 'fake123@hotmail.com',
'comment_content' => quot;Free pr0n and cheap Rolex!quot;
);
if ($akismet->isSpam($commentData)) {
echo quot;Die, Evil Spammer!!!quot;;
} else {
echo quot;Thanks for your comment!quot;;
}
Shahar Evron | Zend Technologies 36
37. Zend_Service_Akismet
Reporting new spam or false positives to Akismet
$commentData = array(
'user_ip' => $_SERVER['REMOTE_ADDR'],
'user_agent' => $_SERVER['HTTP_USER_AGENT'],
'comment_type' => 'trackback',
'comment_author' => 'Honest Bender',
'comment_email' => 'fake123@hotmail.com',
'comment_content' => quot;Free pr0n and cheap Rolex!quot;
);
// Report new spam to Akismet
$akismet->submitSpam($commentData);
// Report false positive (ham) to Akismet
$akismet->submitHam($commentData);
Shahar Evron | Zend Technologies 37
39. Zend_Json
• Allows to easily encode PHP data as JSON* and vice
versa
• Can encode / decode PHP scalars, arrays and
objects
• Will utilize ext/json if available – if not, will use the
written-from-scratch JSON encoder and decoder
* JavaScript Object Notation, http://www.json.org/
Shahar Evron | Zend Technologies 39
40. Zend_Json
Encoding PHP to JSON
require_once 'Zend/Json.php';
$article = array(
'title' => 'How to make a good script great',
'author' => 'Some Guy',
'published' => time(),
'tags' => array('howto', 'scripting', 'script', 'guide')
);
// Encode the PHP array
echo Zend_Json::encode($article);
--- Output ---
{quot;titlequot;:quot;How to make a good script greatquot;,quot;authorquot;:quot;Some Guyquot;,
quot;publishedquot;:1211837898,quot;tagsquot;:[quot;howtoquot;,quot;scriptingquot;,quot;scriptquot;,quot;guidequot;]}
Shahar Evron | Zend Technologies 40
41. Zend_Json
Decoding JSON to PHP
// Decode JSON. Will decode to an associative array by default
$article = Zend_Json::decode($json);
--- Output ---
stdClass Object
(
[title] => How to make a good script great
[author] => Some Guy
[published] => 1211837898
[tags] => Array
(
[0] => howto
[1] => scripting
[2] => script
[3] => guide
)
)
Shahar Evron | Zend Technologies 41
42. Zend_Json
Decoding JSON to PHP
// Decode JSON to stdClass object
$article = Zend_Json::decode($json, Zend_Json::TYPE_OBJECT);
--- Output ---
Array
(
[title] => How to make a good script great
[author] => Some Guy
[published] => 1211837898
[tags] => Array
(
[0] => howto
[1] => scripting
[2] => script
[3] => guide
)
)
Shahar Evron | Zend Technologies 42
44. Zend_Log
• Provides powerful yet easy to use logging capabilities
• Supports different “writers” - can write to several
backends (at the same time even!)
• Uses a default set of error levels, you can add more
• You can apply filters when logging – this allows, for
example, to dynamically change the logging level
• You can apply formatters on writers – this allows
advanced message formatting - for example XML
Shahar Evron | Zend Technologies 44
46. Zend_Log
Quick Start: Logging to standard output
require_once 'Zend/Log.php';
require_once 'Zend/Log/Writer/Stream.php';
// Create a simple log that will write to STDOUT
$log = new Zend_Log(new Zend_Log_Writer_Stream('php://stdout'));
// Log a warning message
$log->log('Something might be wrong', Zend_Log::WARN);
// A simpler way to do the same thing
$log->warn('Something might be wrong');
Output:
2008-05-27T01:15:56+03:00 WARN (4): Something might be wrong
Shahar Evron | Zend Technologies 46
47. Zend_Log
• You can apply one or more Filter objects to both
○ The Log object – this will affect all writers
○ A particular Writer object – this will affect only one write
• Several filters exist, and you can easily create your
own filter classes
• The most common method of filtering messages is by
priority
○ This lets you control the logging verbosity level at run time,
without changing your code
Shahar Evron | Zend Technologies 47
48. Zend_Log
• Default priorities correlate to the syslog standards:
○ EMERG (0)
○ ALERT (1)
○ CRIT (2)
○ ERR (3)
○ WARN (4)
○ NOTICE (5)
○ INFO (6)
○ DEBUG (7)
• You can add your own if needed
Shahar Evron | Zend Technologies 48
49. Zend_Log
Filtering messages according to priority
$log = new Zend_Log();
// Log all messages to a debugging log
$log->addWriter(new Zend_Log_Writer_Stream('debug.log'));
// Log only important messages to STDERR
$stdErr = new Zend_Log_Writer_Stream('php://stderr');
$stdErr->addFilter(new Zend_Log_Filter_Priority(Zend_Log::WARN));
$log->addWriter($stdErr);
// Log an informational message - will only appear in debug.log
$log->info('The application is starting up');
// Log an error message - will appear in both logs
$log->err('Something very bad has happened');
Shahar Evron | Zend Technologies 49
51. Some more components worth looking at
• Zend_Pdf
• Zend_Search_Lucene
• Zend_Memory
• Zend_Auth
• Zend_Acl
• Zend_Console_Getopt
• I18N and L10N components
• ... and the MVC parts as well ;)
Shahar Evron | Zend Technologies 51
52. Got Questions?
• Questions?
• This presentation will be available at:
○ http://prematureoptimization.org/
○ Slideshare: http://www.slideshare.net/shahar
• Feedback and questions: shahar.e@zend.com
Shahar Evron | Zend Technologies 52