Version 1 of the API was a single fat controller with no separation of concerns. Version 2 improved on this but still had code in the AppController. Version 3 used CakePHP's CRUD plugin to automate CRUD actions, implemented filtering and sorting, and separated code into distinct classes and plugins for improved flexibility and extensibility. Lessons learned were to use routing prefixes, CRUD plugins, authentication, and create separation of concerns between classes and plugins.
This document discusses building an API to leverage MJML, an open-source markup language for responsive email design, in backend systems. It considers rewriting MJML in Go, communicating via HTTP, shared memory, or sockets. The author chose to use sockets for communication between a Go API server and Node.js MJML renderer for efficient memory usage and distribution capabilities without extra overhead. The API allows rendering MJML templates to HTML for building beautiful responsive emails.
Using Git with WordPress - Presented by Nigel Rodgers.WordCamp Harare
I will give a brief introduction to the Git Version Control System (VCS). Short demonstration of using git with WordPress. The demo will be for coding a theme or child theme. Then advantages and disadvantages of using a VCS.
Building End to-End Web Apps Using TypeScriptGil Fink
Gil Fink will present on building end-to-end web apps using TypeScript. The presentation will cover why TypeScript is useful, an introduction to TypeScript, building a simple app with TypeScript, and a Q&A. TypeScript is an open source language that compiles to JavaScript, adding features like static typing, classes and modules to support code encapsulation and maintainability. The presentation will demonstrate building a simple app in TypeScript and conclude with resources for learning more.
This document discusses web development and Facebook's technology stack. It begins with an introduction to open source software and web development basics. It then covers PHP and how Facebook uses open source technologies like Linux, Apache, MySQL, and PHP (LAMP stack) across its infrastructure. Specifically, it discusses how Facebook uses PHP HipHop, a source code transformer that compiles PHP into highly optimized C++ code, to improve performance of its sites and applications.
This document discusses Vaadin, an open source web application framework for building single-page web applications. It provides an introduction to Vaadin, outlines the requirements to get started including a Java development kit and servlet container. It also discusses how Vaadin is extensible through add-ons and provides additional resources for learning more about Vaadin development.
Robin Böhm - Angular 2 - code.talks 2015AboutYouGmbH
This document appears to be a presentation about AngularJS and Angular 2 by Robin Böhm. It discusses the history and growth of AngularJS, the key changes and new features in Angular 2 like being mobile-first and using web components. It also covers migrating from AngularJS 1 to Angular 2, the current alpha release status of Angular 2, and differences in concepts like bindings, annotations and services between the two frameworks. Slides include charts about Google search trends for AngularJS and information about Robin Böhm and his company Symetics which supports the AngularJS community.
Creating real time applications with Angular and FirebaseLoiane Groner
This document discusses how to create real-time applications using Angular and Firebase. It covers Firebase features like the real-time database, authentication, cloud functions, and hosting. It also discusses how to connect Angular applications to Firebase using the AngularFire library and shows demos of retrieving and updating data from Firebase in an Angular application.
The document discusses migrating a Java project to Kotlin. It introduces Paulien van Alst and her experience migrating a project from Java to Kotlin at bol.com. The migration plan involves setting up Kotlin dependencies, migrating POJOs, continuing with business logic, and finishing configuration. Code examples are provided for each step. Overall the migration was smooth, with some Spring integration tricks. The resulting Kotlin code is more readable and concise.
The document discusses CakePHP 2.0 and introduces the speaker who is a web developer specializing in PHP, CakePHP, HTML, CSS, jQuery, MySQL, and iPhone development. It then demonstrates the CakePHP Kickstart Plugin which can initialize CakePHP projects and install plugins from GitHub repositories with a few commands. Finally, it briefly mentions four CakePHP plugins for Twitter integration, a content management system, and a REST data source.
Untangle Your Front End Development with Visual Studio 2015Scott Heckel
This document discusses how Visual Studio 2015 helps untangle front end development. It introduces ASP.NET 5, the new web project structure in VS 2015, and how it embraces front end tooling like Node.js, Bower, Grunt and Gulp. It explains how these tools are used to install and manage dependencies, automate tasks, and enforce semantic versioning. Examples of popular NPM and Bower packages are also provided.
Going Global with WordPress Multilingual (WordCamp Denpasar 2016)Dat Hoang
By default, WordPress accepts a single language only. In this topic, I talk about the possibility to have a multilingual WordPress site.
Event 1: WordCamp Denpasar 2016
Link: https://2016.denpasar.wordcamp.org/
Event 2: WordCamp Manila 2016
Link: https://2016.manila.wordcamp.org/
This document confirms that Konstantin Pankratov completed several online courses on software development topics including ASP.NET MVC 4, database fundamentals, HTML5, JavaScript, CSS3, VB, and C# as the courses are listed with completion dates. The document concludes by congratulating Konstantin Pankratov on this achievement.
This document discusses Progressive Web Apps (PWAs) and how to build them. It covers key aspects of PWAs like being progressive, responsive, and working offline. It also discusses the manifest file, service workers, precaching files with webpack, checking performance with Lighthouse, and how to install and launch a PWA. The document is presented as a slide deck for a training on developing PWAs.
WordPress on the Jamstack by rtCamper Muhammad Muhsin @ WordPress Colombo MeetuprtCamp
Jamstack sites have received huge popularity lately. Muhammad Muhsin has explored WordPress as a viable back-end API for Jamstack, which turned out to be a great solution. He has built multiple Jamstack sites using WordPress for data via REST API or GraphQL.
In this session, Muhammad introduces WordPress as an API for Jamstack sites.
This document discusses the benefits of JUnit testing and test-driven development (TDD) for XPages applications. It encourages testing from both a user and developer perspective to ensure functionality and catch errors. The TDD mantra of writing a test first, making it fail, then fixing the code to pass the test is explained. An example of a test for currency conversion is provided. OpenNTF's JUnit plugin for XPages is recommended to allow testing. Benefits of TDD like catching errors quickly, understanding requirements, and relaxing because code is tested are outlined. The talk concludes by recommending a book on TDD by example.
Women Who Mule - Workshop series: Create your own blog from scratch without a...Alexandra N. Martinez
In this meetup, we'll give you a presentation about some tools that you can use to create your own blog from scratch without having to write a single line of code! - Yes, you don't need to be a web programmer to do this. You just need to drag-and-drop or click components. You'll be up and running in less than a day!
To The Word And Beyond! Extending WordPress Past a Simple BlogMeagan Hanes
This presentation looks at novel and unique ways to use WordPress beyond a simple blog or website by using BuddyPress, bbPress, and P2. Ever think of using WordPress to manage a project, be a private communication board, or even have a forum? We’ll cover these and more uses that truly push WordPress to its limits. Bonus: 3 Plugins to help streamline your Dashboard experience!
This document profiles Diego Pacheco and provides an overview of Spring Boot. It describes Diego as a software architect, agile coach, and speaker. It then summarizes the key features of Spring Boot, including its focus on creating production-ready spring applications with minimal configuration and no code generation. It provides links to sample code and documentation on specific Spring Boot features like SQL/NoSQL support, web MVC, messaging, and more.
3|SHARE has developed SnapBuild for CQ5, a tool that aims to increase developer productivity on Adobe Experience Manager (CQ5) projects. SnapBuild provides an Eclipse plugin that allows for drag-and-drop CQ5 application development through automated generation of Maven builds, templates, components and other project elements. The goal is to standardize best practices, simplify the learning curve and accelerate development time compared to traditional manual Maven configuration and CRXDE development. 3|SHARE sees SnapBuild as a major improvement over the current state of CQ5 development.
Talk in GTUG Taipei 2013/5/9. There's some work to make web as webapp. The slide addressed the extra steps for existing web site, and suggest some tools and guide for newly developed website.
webapplate http://github.com/gasolin/webapplate
FxOSBMI https://github.com/gasolin/FxOSBMI
Don't Code, Bake. An introduction to CakePHP ~PHP Hampshire Oct 2014David Yell
This document introduces CakePHP, an open source PHP web framework. It discusses the MVC architecture that CakePHP uses and how it makes building web applications simpler with features like convention over configuration. The document also provides overviews of the core components in CakePHP, including models, controllers, views, behaviors and plugins. It compares CakePHP versions 2.x and 3.x and provides resources for learning more about CakePHP.
PHP South Coast - Don't code bake, an introduction to CakePHP 3David Yell
CakePHP is a PHP web framework that makes building web applications simpler, faster and require less code through its conventions over configuration approach and features like rapid application development, the model-view-controller pattern, behaviors, components, helpers and plugins. The document introduces CakePHP and compares version 2 and 3, provides an overview of its key features for models, controllers, views and more, and recommends resources for learning more.
GoPro, Inc. Case study: Dive into the details of our web applicationsAndrew Maxwell
The document discusses GoPro's web applications. It outlines GoPro's goals for their applications, including following the Unix philosophy, isolating apps that connect only through login, basing apps on a common framework, running all apps in Docker, and enabling independent deploys. It also describes their development setup, coding process, problems encountered and solutions, and plans for the future, including continued framework improvements and more testing.
The Joomlatools Platform is a modern Joomla distribution that helps you get started with the best development tools and project structure.
Much of the philosophy behind the platform is inspired by the Twelve-Factor App methodology.
Pro Magento MeetUp #4 - Upgrade Compatibility Tool, Sergii IvashchenkoPro Magento Community
Topic - Upgrade Compatibility Tool
Speaker - Sergii Ivashchenko, Tech Lead at Adobe Commerce
Presenters:
Andrey Zabara – Magento Tech Lead, IT Delight
Link to the webinar recording - https://youtu.be/Bh25NHD_Dxs
Pierre Joye gave a presentation on using Windows as a platform for PHP development. He discussed why developers would want to use Windows, including tools like PECL, the Web Platform Installer, IIS integration, and the SqlServer Native Driver. He also covered performance benefits of IIS and demoed tools for PHP development on Windows like IDE/VS.php and Expression Web 3.
Introducing ASP.NET vNext - A tour of the new ASP.NET platformJeffrey T. Fritz
This document introduces ASP.NET vNext, which is a new modular and open source version of ASP.NET that is faster, more flexible, and optimized for cloud deployment. It highlights key changes like being totally modular, using NuGet packages, supporting new project types, and merging MVC, Web API, and Web Pages. The document warns that ASP.NET vNext is not ready for production and is intended to show the direction ASP.NET is headed. Resources for learning more are provided.
Modular Web Applications based on OSGi - Jochen Hillermfrancis
This document discusses a proposed "Web Application Service" that allows for modular web applications based on OSGi. The service would parse a web.xml file to register servlets, filters, and other configuration for a web application across OSGi bundles. It aims to simplify deployment of existing web applications to OSGi. Currently taglib support, listeners, and security are missing but under development. The service follows the extender pattern and API to integrate with OSGi bundles and web containers. A demo is shown of deploying Tomcat examples as OSGi bundles using this approach.
The future of ASP.NET / CodeCamp/Iasi 25 Oct 2014Enea Gabriel
After more than 10 years of web development using the ASP.NET framework, an important shift in the .NET web development platform has begun. In this talk we will see how the existing ASP.NET web technologies emerge together on a new lean and composable .NET vNext stack for building tomorrow's web and cloud based applications.
Introducing ASP.NET vNext – The Future of .NET on the Server | FalafelCON 2014FalafelSoftware
In this session, ASP.NET MVP Jeff Fritz will introduce you to the next version of ASP.NET. He will show you how Microsoft is decoupling ASP.NET, making it easier to build modular applications. We’ll see how the world of NuGet and lightweight VMs enable you to build faster and simpler web applications. This session will change the way you look at ASP.NET, and you’ll be ready for the next generation of web development, today.
Making sense of the front-end, for PHP developersLewiz
The complexity of frontend web development has increased measurably. Gone are the days of jQuery. New frameworks like React and Vue and tools like Webpack are the new deal.
In this talk, we will try to make sense of the current state of front-end development and how it changes how we write backend code. More specifically, we will see how Symfony and Laravel help us in that regard.
The Joomlatools Platform is a modern Joomla stack that helps you get started with the best development tools and project structure.
Much of the philosophy behind the platform is inspired by the Twelve-Factor App methodology.
This document discusses improvements to PHP performance on Windows over the past few years. Key points include:
- PHP performance on Windows has improved significantly through the use of FastCGI, PHP 5.3 optimizations, and the WinCache opcode cache.
- FastCGI avoids starting new PHP processes for each request, reusing processes in a pool for better performance.
- WinCache provides opcode, file, and path caching to further boost PHP performance on Windows.
- PHP 5.3 brought optimizations like using the VC9 compiler and optimized Windows API calls.
- Future work includes popular PHP apps adopting WinCache and continued WinCache improvements.
PHP on IIS has had an amazing performance jump in the past 2-3 years but you can always squeeze a little more torque out of an engine with the right tuning. In this session we’ll dive into improvements in FastCGI and fantastic new libraries such as WinCache 1.1 for exceptional performance in your applications as we go under the hood with IIS.
This document introduces Codeception, an open source PHP testing framework. It discusses different types of testing like unit, integration, functional, and acceptance testing. Codeception uses PHPUnit, Symfony browserkit, Selenium, and PhantomJS to test PHP applications. The document demonstrates running Codeception tests and provides examples of passing and failing tests. It also discusses how Codeception allows testing JavaScript-heavy applications using Selenium or headless testing with PhantomJS. Continuous integration and Docker/Vagrant are presented as ways to improve testing workflows.
Apigility is a tool introduced in 2013 by Zend and the Zend Framework community, designed to handle in a simple graphical interface the configuration, management and creation of APIs, and provides classes to support API development.
This presentation is a quick but hopefully interesting introduction to this tool, aiming to demonstrate some of the most important features.
This document discusses using Angular elements and web components. It provides an introduction to web components and Angular elements, how to dynamically add web components, load external web components, and exclude zone.js for zone-less change detection. It also demonstrates content projection and slot APIs. The document aims to explain how web components can provide framework independence and long term maintainability for applications.
Unlocking the Future of Artificial IntelligencedorinIonescu
Unlock the Future: Dive into AI Today! Videnda AI specializes in developing advanced artificial intelligence solutions, including visual dictionaries and language learning tools that leverage immersive virtual travel experiences. Stay Ahead of the Curve: Master AI Now! Our AI technology integrates machine learning and neural networks to enhance education and business applications. AI: The Next Frontier. Are You Ready to Explore? With a focus on real-time AI solutions and deep learning models, Videnda AI provides innovative tools for multilingual communication and immersive learning.
In this course, you'll find a series of engaging videos packed with vibrant animations that break down complex AI concepts into digestible pieces. Our curriculum covers AI models such as Convolutional Neural Networks (CNN), Multi-Layer Perceptrons (MLP), Generative Adversarial Networks (GAN), and Transformers, providing a solid understanding of these models and their real-world applications. We also offer hands-on experience with Generative AI tools like ChatGPT and Midjourney, and Python programming tutorials to help you implement AI algorithms and build your own AI applications.
We are proud participants in the Nvidia Inception Program, driving AI innovation across various industries. By the end of our course, you'll have a strong understanding of AI principles, enhanced Python programming skills, and practical experience with state-of-the-art Generative AI tools. Whether you're looking to kickstart a career in AI or simply curious about this revolutionary technology, Videnda AI is your partner in mastering the future of artificial intelligence.
The code is written and the tests pass. I just have to commit this last round of changes to my branch. Wait, why does that say committed to main? Did I commit all those changes to main? Arghh! I can’t redo all of this!
Committing changes to the wrong branch, forgetting files, misspelling the commit message, and needing to undo commits are some of the “advanced” features of Git that we normal people run into way too often and need help with. The fixes are often easy – once you know what they are. But in the heat of the moment, with the deadline (or Friday afternoon) approaching, it isn’t always easy to figure out what magic spell to cast to get Git to do what you need.
We’ll spend some time looking at typical Git situations people get themselves into, and then we’ll demonstrate how to get out of them. This isn’t about Git internals or a Git master’s class – this real-world Git when things aren’t going right. And there will be plenty of time for questions, so bring your “best” Git nightmare scenarios so we can figure out how to recover.
Mastering MicroStation DGN: How to Integrate CAD and GISSafe Software
Dive deep into the world of CAD-GIS integration and elevate your workflows to nexl-level efficiency levels. Discover how to seamlessly transfer data between Bentley MicroStation and leading GIS platforms, such as Esri ArcGIS.
This session goes beyond mere CAD/GIS conversion, showcasing techniques to precisely transform MicroStation elements including cells, text, lines, and symbology. We’ll walk you through tags versus item types, and understanding how to leverage both. You’ll also learn how to reproject to any coordinate system. Finally, explore cutting-edge automated methods for managing database links, and delve into innovative strategies for enabling self-serve data collection and validation services.
Join us to overcome the common hurdles in CAD and GIS integration and enhance the efficiency of your workflows. This session is perfect for professionals, both new to FME and seasoned users, seeking to streamline their processes and leverage the full potential of their CAD and GIS systems.
How to Secure Your Kubernetes Software Supply Chain at ScaleAnchore
Achieving comprehensive security visibility in Kubernetes environments is essential for maintaining robust and compliant cloud-native applications. In this exclusive webinar, Anchore and Spectro Cloud team up to showcase how to enhance your Kubernetes security posture with SBOM (Software Bill of Materials) management and vulnerability scanning.
Join Cornelia Davis, VP of Product, Spectro Cloud and Alan Pope, Director of Developer Relations, Anchore to learn how to elevate your Kubernetes security visibility and protect your cloud-native applications effectively.
—Discover how Anchore can be integrated with Spectro Cloud Palette to take SBOM scanning to the next level, delivering fully automated software compliance
—Gain valuable insights into best practices for securing your Kubernetes workloads, ensuring compliance, and improving your DevSecOps processes.
Three available editions of Windows Servers crucial to your organization’s op...Q-Advise
Three available editions of Windows Servers crucial to your organization’s operations
Windows Server, Microsoft’s robust operating system, is the cornerstone of enterprise IT infrastructure, tailored for mission-critical operations. It helps in managing enterprise-level tasks, including data storage, applications, and communication.
Proper licensing of Windows Server is essential for both legal compliance and optimal functionality within business environments.
Windows Server comes in various edition and before any edition is used in your organization, it is required you license them appropriately. The licensing can be complex and capital demanding when you don’t know what you want or understand the licensing requirements.
Even if successfully licensed, there are various activities you can practice as an organization to make sure your Server is operating optimally and there is real value for money. This requires a deeper understanding of best practices and our team of cloud and licensing experts can be of support.
Send the team an email, info@q-advise.com let’s have a look at your needs, together with you decide which licensing model will best work in your case, assist you with savings options and share with you how pre-owned licensing can help you get licensed adequately also.
Predicting Test Results without Execution (FSE 2024)Andre Hora
As software systems grow, test suites may become complex, making it challenging to run the tests frequently and locally. Recently, Large Language Models (LLMs) have been adopted in multiple software engineering tasks. It has demonstrated great results in code generation, however, it is not yet clear whether these models understand code execution. Particularly, it is unclear whether LLMs can be used to predict test results, and, potentially, overcome the issues of running real-world tests. To shed some light on this problem, in this paper, we explore the capability of LLMs to predict test results without execution. We evaluate the performance of the state-of-the-art GPT-4 in predicting the execution of 200 test cases of the Python Standard Library. Among these 200 test cases, 100 are passing and 100 are failing ones. Overall, we find that GPT-4 has a precision of 88.8%, recall of 71%, and accuracy of 81% in the test result prediction. However, the results vary depending on the test complexity: GPT-4 presented better precision and recall when predicting simpler tests (93.2% and 82%) than complex ones (83.3% and 60%). We also find differences among the analyzed test suites, with the precision ranging from 77.8% to 94.7% and recall between 60% and 90%. Our findings suggest that GPT-4 still needs significant progress in predicting test results.
Tube Magic Software | Youtube Software | Best AI Tool For Growing Youtube Cha...David D. Scott
Tube Magic Software is your ultimate tool for creating stunning video content with ease. Designed with both beginners and professionals in mind, it offers a user-friendly interface packed with powerful features. From seamless editing to eye-catching effects, Tube Magic helps you bring your creative vision to life. Elevate your videos and captivate your audience effortlessly. Join our community of content creators and experience the magic today!
Fix Production Bugs Quickly - The Power of Structured Logging in Ruby on Rail...John Gallagher
Rails apps can be a black box. Have you ever tried to fix a bug where you just can’t understand what’s going on? This talk will give you practical steps to improve the observability of your Rails app, taking the time to understand and fix defects from hours or days to minutes. Rails 8 will bring an exciting new feature: built-in structured logging. This talk will delve into the transformative impact of structured logging on fixing bugs and saving engineers time. Structured logging, as a cornerstone of observability, offers a powerful way to handle logs compared to traditional text-based logs. This session will guide you through the nuances of structured logging in Rails, demonstrating how it can be used to gain better insights into your application’s behavior. This talk will be a practical, technical deep dive into how to make structured logging work with an existing Rails app.
I talk about the Steps to Observable Software - a practical five step process for improving the observability of your Rails app.
Crowd Strike\Windows Update Issue: Overview and Current Statusramaganesan0504
Crowd Strike\Windows Update Issue: Overview and Current Status
Discover the latest on the CrowdStrike Windows update issue, including an overview, current status, and support steps for affected customers. Learn about the identified defect, its impact on Windows hosts, and CrowdStrike's committed actions to ensure ongoing security and stability.
What is CrowdStrike?
CrowdStrike is a prominent cybersecurity technology company that specializes in providing advanced threat intelligence and endpoint protection solutions. Founded in 2011 by George Kurtz, Dmitri Alperovitch, and Gregg Marston, CrowdStrike has quickly established itself as a leader in the cybersecurity industry. Here are some key aspects of
Waze vs. Google Maps vs. Apple Maps, Who Else.pdfBen Ramedani
Let’s face it, getting lost isn’t really part of the adventure anymore (unless you’re into that sort of thing!). Nowadays, a good navigation app is like your trusty compass, guiding you through busy city streets and winding country roads. But with so many options out there—from big names like Waze, Google Maps, and Apple Maps to some lesser-known contenders—choosing the right one can feel a bit overwhelming.
Think about it: you're about to head out on a road trip, and the last thing you want is to end up in the middle of nowhere because you took a wrong turn. Or maybe you're just trying to navigate your daily commute without hitting every single red light. That's where a solid navigation app comes in handy.
Google Maps is like the old reliable friend who knows every shortcut and scenic route. It's packed with features, from real-time traffic updates to detailed directions, making it a top choice for many. But then there's Waze, the social butterfly of navigation apps. It's all about community, with drivers sharing real-time updates on traffic, accidents, and even speed traps. It’s perfect if you want to feel like you’re part of a huge driving club, all working together to get everyone to their destination faster.
And let’s not forget Apple Maps, which has come a long way since its rocky start. If you're deep into the Apple ecosystem, it's a seamless choice, integrating smoothly with all your devices and offering some pretty neat features like Flyover for 3D city views.
But wait, there are also some underdog apps worth considering! Have you heard of MapQuest? It's still around and offers some great features, especially for planning long trips with multiple stops. Then there's HERE WeGo, which is fantastic for offline navigation—a real lifesaver if you're heading somewhere with spotty cell service.
So, whether you're planning a cross-country adventure or just trying to find the quickest route to work, we’ll help you sift through these options. We’ll dive into what makes each app unique, their pros and cons, and ultimately, guide you to the perfect navigation app for your needs. Buckle up and get ready for a smooth ride!
Test Polarity: Detecting Positive and Negative Tests (FSE 2024)Andre Hora
Positive tests (aka, happy path tests) cover the expected behavior of the program, while negative tests (aka, unhappy path tests) check the unexpected behavior. Ideally, test suites should have both positive and negative tests to better protect against regressions. In practice, unfortunately, we cannot easily identify whether a test is positive or negative. A better understanding of whether a test suite is more positive or negative is fundamental to assessing the overall test suite capability in testing expected and unexpected behaviors. In this paper, we propose test polarity, an automated approach to detect positive and negative tests. Our approach runs/monitors the test suite and collects runtime data about the application execution to classify the test methods as positive or negative. In a first evaluation, test polarity correctly classified 117 tests as as positive or negative. Finally, we provide a preliminary empirical study to analyze the test polarity of 2,054 test methods from 12 real-world test suites of the Python Standard Library. We find that most of the analyzed test methods are negative (88%) and a minority is positive (12%). However, there is a large variation per project: while some libraries have an equivalent number of positive and negative tests, others have mostly negative ones.
Test Polarity: Detecting Positive and Negative Tests (FSE 2024)
How I built web services in CakePHP
1. How I built web services in CakePHP
Amsterdam
2016
2. Introduction
PHP Developer
at UK Web Media
in Weyhill, UK
http://www.ukwm.co.uk
Cyberstalk me!
https://twitter.com/YellDavid
https://github.com/davidyell
http://careers.stackoverflow.com/davidyell
http://uk.linkedin.com/in/davidyell
#cakephp on Freenode IRC
David Yell
aka Neon1024
9. Setup
/api/v2
Yey!
●
Shares existing code
●
More generic
● Extensibility
● Per endpoint customisation
Boo!
●
Hard to create common filtering
● Too much code in AppController
●
Lacks separation
Routing
Request
Response
Application
Version 2
v2 prefix
AppController ProductsController
10. API Design choices
Pragmatic approach
Complex queries but more complete responses
Allows complete configured return
Flexible filtering and sorting
Specific use-cases
Further reading,
http://www.bravo-kernel.com/tags/api/
11. Version 3
Routing
Request
Response
api prefix
v3 route
ApiAppController
Crud plugin
Custom Crud actions
Contain class Filter class
Yey!
● Crud automation
● Free sorting and pagination
● Code separation
● Extensible
Boo!
● Complexity
Setup
/api/v3
ApiQuery Behavior
18. Version 3
Example queries
Get packages with related data, where line rental is included,
from provider id 4, matching an associated Table field, sorted
by price, on page 2.
/api/v3/packages.json
?verbose=true
&filter[line_rental_included]=true
&filter[provider_id]=4
&filter[Related.something]=foo
&site_id=n
&limit=20
&page=3
&sort=price
&direction=asc
Free with Crud plugin!
19. Version 3
Example queries
Get a specific list of packages in a certain order.
/api/v3/packages.json
?id[0]=19
&id[1]=17
&id[2]=11
&id[3]=43
&site_id=n
20. Lessons learned
Don't
● Single controller
● Filter in controller
Do
● Routing prefixes
● Crud plugin
● Authentication
● Create separation
● Integration testing
22. Consuming the API
Cake 2
Custom data source
http://book.cakephp.org/2.0/en/models/datasources.html
23. Muffin/WebService Cake 3 driver
http://jedistirfry.co.uk/blog/2015-09/connecting-to-a-web-service/
Consuming the API
Cake 3
24. Thanks!
Questions?
Please rate my talk
https://joind.in/talk/e2065
Attend your local PHP Usergroup! http://php.ug/
http://osmihelp.org/donate
Editor's Notes
Thanks for voting on my talk, I really appreciate it.
Nearly 10 years commercial experience, mostly agencies doing campaign work.
Started with HTML on GeoCities.
Self-taught in PHP, started with CakePHP on 1.3 in 2008 ish and am in the Friends of Cake group
UKWM do campaign and affiliate marketing work, I work mostly on the telecoms sites comparing broadband, tv and phone
All our stuff is CakePHP 2 or 3, I'm migrating stuff as and when I have time
This is the first run of this presentation so be gentle!
I will hopefully have some time at the end for questions.
It's what I do for my job
v1 is the first api I ever built!
It's a read only web service
Built by myself, used by myself
Work in progress
We are silo'd at work, so you guys are doing my code review for me!
The web service driver is a Datasource in Cake 2, and a web service driver in Cake 3.
The use-case is a centrally managed data-store
ApiUpdatable has a queue to schedule updates from the client site
It also has a shell run on a cron
Thin clients pull data from the web service on render and use local cache
Multiple versions of the API with clients being migrated over
First ever api I built
A plugin seemed logical at the time
Coded first rather than designing it
Difficult containing deep associations, 4-5 levels
Ended up filtering data in the view, so the pagination meta was wrong
Index method in ApiController is 247 lines long!
If your controller looks like this, stop, and rethink
Not flexible enough to expand to cover new use-cases easily
Plugin needs tagging and releasing
Duplicating functionality which already exists in the application
Manual work to create the views
Who knows what past me was thinking with this one.
Even the templates are in the other plugin!
All base endpoint methods are in the AppController
Overload the methods as needed
Extended methods means filtering would be complex on a per endpoint basis
Never even made it out of the branch!
Reqs:
Allows for complex sorting and filtering combinations
Makes my client implementation simple
Full comparison table data
Pragmatic approach, practice rather than theory
Fulfils use-cases of complex full data returns
Not using the RESTful routing
Hidden the _matchingData
Focus on simplicity for the client
The utopian vision of everything being achievable
Controller inheritance
Crud plugin makes it easy
Custom actions to call behavour methods on the query
Behaviour uses custom finders to modify query
Uses the ORMs stackable finders feature
Doesn't adhere to REST standard, pragmatic and solo! ;)
Filter and contain classes implement an interface, and customised per endpoint
As Jose said in the workshop, don't be scared to go outside the framework
Related data class also deals with sortable whitelist
Luckily I have only 5 endpoints, 2 primary ones
Neat code separation
Can still inherit from ApiController
Easy to run multiple versions from the same app
Can help you build a basic api in literally minutes!
Comes with pagination and sorting out of the box
Has various api listeners,
Api
ApiPaginator
ApiQueryLog
Search listener implements the friendsofcake/search plugin
Not as complicated as it appears, I'm working on the docs, so any contributions welcome!
Copy and paste of the default crud action
Just added some extra methods to hook into the query object
The methods just look for the behaviour and call it's custom finders on the query
Example Crud index action method
_table is the current table, proxied call to Controller::loadModel() in Crud core
Just passing a Cake\ORM\Query object
Awesome because it's lazy I can build the query programatically and execute it later
Relies on awesome Cake 3 ORM with closures in my contains to filter my associations
Highly customisable
Boss asked to remove pricing, comment out the line, job done, 2 mins – comment because I know he'll change his mind ;)
Low impact, as it's tied to a single endpoint
Lots of code though, so can look daunting
Manages both Joins and Contains, as some fields must be joined for filtering and sorting
Lives in src/Lib/Api/RelatedData
Build filters as an array in the url
I can pass all the filters around by just passing the array
Allow for highly complex filtering
Flexible and easy for clients to understand
Has custom field filters too such as minPrice and maxPrice which map to the price field
Lives in src/Lib/Api/Filters
Might not want to expose your schema
Could use a custom JSON view or use Fractal
Can return a complete response for the client implementation
For affiliate marketing comparison tables we need things in an arbitrary order set in the client site CMS
Again,
- Might not want to expose your schema
- Could use a custom JSON view or use Fractal
Routing prefixes good for versioning, as they can be nested! So why not an api prefix, with a v2 prefix and v3 prefix?
Don't be constrained by the framework where it doesn't make sense.
Not all of your code needs to fit into the framework, but check first!
Theoretical paralysis, too much thinking not enough doing.
Be pragmatic.
Create a branch, try a thing, ditch it and start over.
Three branches before sorting worked!
Testing using json fixture files
Postman client for testing your endpoints yourself
Cake 2 ApiUpdatable behaviour swaps the datasource based on if the query has the ‘api’ => true option set in the find conditions using a callback
Data returned as json array
Service info configured in your app.php under Webservices config key
Will return json entities directly from a cake 3 endpoint
If you'd like to discuss anything in my talk, please come see me for a chat.