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.
Don't code bake, an introduction to CakePHP 3. A presentation giving an overview of the latest version of the framework and why I think it's worth checking out.
Building a plugin like a pro it’s not only about code, it’s also about how you do that. I talked about the workflow, how WordPress works and how I build plugins. I also discussed some mistakes I made along the way. Doing something in a hurry is never a good thing.
Live coding session that will guide you step by step through building a solid foundation for your Angular project using webpack.
Webpack is a powerful module bundler that is easy to configure and use. In most cases it can replace your build system by taking care of code compilation, optimizations and bundling.
Don't code bake, an introduction to CakePHP 3. A presentation giving an overview of the latest version of the framework and why I think it's worth checking out.
Building a plugin like a pro it’s not only about code, it’s also about how you do that. I talked about the workflow, how WordPress works and how I build plugins. I also discussed some mistakes I made along the way. Doing something in a hurry is never a good thing.
Live coding session that will guide you step by step through building a solid foundation for your Angular project using webpack.
Webpack is a powerful module bundler that is easy to configure and use. In most cases it can replace your build system by taking care of code compilation, optimizations and bundling.
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.
From Java to Kotlin: the adventures of a smooth migration
Most of the Java applications are written in Java 8 nowadays and people are looking around to upgrade to Java 11 or even migrating to Kotlin. Both are promoted as the new way to go and both have their own strengths. Upgrading to Java 11 might be an obvious next safe step to do and probably the most used frameworks will be Java 11 compliant soon. But what if you could migrate to Kotlin with the same effort? This would bring you additional advantages like: data class, very concise list manipulations, extension functions and even more to get you’re code more readable and maintainable.
Considering the Kotlin migration, the first questions that pop up are: What are the wise steps to take and where to start? Some experiences and thoughts answering these questions will be shared during this live coding session.
Untangle Your Front End Development with Visual Studio 2015Scott Heckel
Microsoft has enhanced the VS tooling to support the front end development standards. In this session, we will setup a web project and learn to utilize node, npm, grunt, gulp, sass and bower to get our website up and running. Never heard of those tools before? Don't worry. We will cover that too.
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/
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.
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!
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
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.
From Java to Kotlin: the adventures of a smooth migration
Most of the Java applications are written in Java 8 nowadays and people are looking around to upgrade to Java 11 or even migrating to Kotlin. Both are promoted as the new way to go and both have their own strengths. Upgrading to Java 11 might be an obvious next safe step to do and probably the most used frameworks will be Java 11 compliant soon. But what if you could migrate to Kotlin with the same effort? This would bring you additional advantages like: data class, very concise list manipulations, extension functions and even more to get you’re code more readable and maintainable.
Considering the Kotlin migration, the first questions that pop up are: What are the wise steps to take and where to start? Some experiences and thoughts answering these questions will be shared during this live coding session.
Untangle Your Front End Development with Visual Studio 2015Scott Heckel
Microsoft has enhanced the VS tooling to support the front end development standards. In this session, we will setup a web project and learn to utilize node, npm, grunt, gulp, sass and bower to get our website up and running. Never heard of those tools before? Don't worry. We will cover that too.
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/
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.
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!
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
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
Introducing ASP.NET vNext - A tour of the new ASP.NET platformJeffrey T. Fritz
Jeff Fritz shares how to get started with the new ASP.NET framework. He covers the goals and intents of Microsoft, and shows how you can get involved with this exciting open-source project. By the end of the presentation, you'll understand and be comfortable with the changes coming in the next version of ASP.NET
Modular Web Applications based on OSGi - Jochen Hillermfrancis
OSGi DevCon 2008
The OSGi HttpService is very lightweight and restricted to very early Servlet specifications (missing filters, listeners, etc.).
This short talk will give an overview about a lightweight web container implementation based on the OSGi HttpService. This container will parse web.xml and add missing functionality (welcome files, filters, listeners) to HttpServices using wrapper technologies. This container service will also be provided as an Eclipse extension point and as bundle observing all bundles within the platform for a /WEB-INF/web.xml file (extender pattern). The implementation is very similar to specification of OSGI RFC 66 – OSGi web container.
Based on this service, a new type of web application can be designed. It is based on multiple small web applications (like WAR files, here: OSGi bundles) which can be combined into one single URI space, whereas the URIs can be mixed together on a deep level.
The talk will give an overview about the implementation, usage scenarios and probably a simple online demo.
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.
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.
Demonstrating of how Codeception can help us, PHP developers, with the issues that affect testing of projects with dynamic frontend (angular, ember, etc.).
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.
Understand how you can create web components using an angular element, pollyfills, differential loading, dynamically loading web components, zone less change detection in angular, content project and slot api.
MadridDevops September 2014: "From chef09 to chef11, one approach to devops"Antonio Peña
MadridDevops September 2014 Meeting: "From chef09 to chef11, one approach to devops"
Madrid, September 25, 2014
http://madrid.devops.es
Just an excuse to talk about devops, chef (and puppet as comparison), its culture , its community and a migration project I have been involved with.
Similar to How I built web services in CakePHP (20)
Software Engineering, Software Consulting, Tech Lead, Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Transaction, Spring MVC, OpenShift Cloud Platform, Kafka, REST, SOAP, LLD & HLD.
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
In this slide, we show the simulation example and the way to compile this solver.
In this solver, the Helmholtz equation can be solved by helmholtzFoam. Also, the Helmholtz equation with uniformly dispersed bubbles can be simulated by helmholtzBubbleFoam.
GraphSummit Paris - The art of the possible with Graph TechnologyNeo4j
Sudhir Hasbe, Chief Product Officer, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
Science gateways allow science and engineering communities to access shared data, software, computing services, and instruments. Science gateways have gained a lot of traction in the last twenty years, as evidenced by projects such as the Science Gateways Community Institute (SGCI) and the Center of Excellence on Science Gateways (SGX3) in the US, The Australian Research Data Commons (ARDC) and its platforms in Australia, and the projects around Virtual Research Environments in Europe. A few mature frameworks have evolved with their different strengths and foci and have been taken up by a larger community such as the Globus Data Portal, Hubzero, Tapis, and Galaxy. However, even when gateways are built on successful frameworks, they continue to face the challenges of ongoing maintenance costs and how to meet the ever-expanding needs of the community they serve with enhanced features. It is not uncommon that gateways with compelling use cases are nonetheless unable to get past the prototype phase and become a full production service, or if they do, they don't survive more than a couple of years. While there is no guaranteed pathway to success, it seems likely that for any gateway there is a need for a strong community and/or solid funding streams to create and sustain its success. With over twenty years of examples to draw from, this presentation goes into detail for ten factors common to successful and enduring gateways that effectively serve as best practices for any new or developing gateway.
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
Keep tabs on your field staff effortlessly with Informap Technology Centre LLC. Real-time tracking, task assignment, and smart features for efficient management. Request a live demo today!
For more details, visit us : https://informapuae.com/field-staff-tracking/
Developing Distributed High-performance Computing Capabilities of an Open Sci...Globus
COVID-19 had an unprecedented impact on scientific collaboration. The pandemic and its broad response from the scientific community has forged new relationships among public health practitioners, mathematical modelers, and scientific computing specialists, while revealing critical gaps in exploiting advanced computing systems to support urgent decision making. Informed by our team’s work in applying high-performance computing in support of public health decision makers during the COVID-19 pandemic, we present how Globus technologies are enabling the development of an open science platform for robust epidemic analysis, with the goal of collaborative, secure, distributed, on-demand, and fast time-to-solution analyses to support public health.
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Globus
Large Language Models (LLMs) are currently the center of attention in the tech world, particularly for their potential to advance research. In this presentation, we'll explore a straightforward and effective method for quickly initiating inference runs on supercomputers using the vLLM tool with Globus Compute, specifically on the Polaris system at ALCF. We'll begin by briefly discussing the popularity and applications of LLMs in various fields. Following this, we will introduce the vLLM tool, and explain how it integrates with Globus Compute to efficiently manage LLM operations on Polaris. Attendees will learn the practical aspects of setting up and remotely triggering LLMs from local machines, focusing on ease of use and efficiency. This talk is ideal for researchers and practitioners looking to leverage the power of LLMs in their work, offering a clear guide to harnessing supercomputing resources for quick and effective LLM inference.
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
We explore the Globus Connect Server (GCS) architecture and experiment with advanced configuration options and use cases. This content is targeted at system administrators who are familiar with GCS and currently operate—or are planning to operate—broader deployments at their institution.
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
Software Engineering, Software Consulting, Tech Lead.
Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Security,
Spring Transaction, Spring MVC,
Log4j, REST/SOAP WEB-SERVICES.
We describe the deployment and use of Globus Compute for remote computation. This content is aimed at researchers who wish to compute on remote resources using a unified programming interface, as well as system administrators who will deploy and operate Globus Compute services on their research computing infrastructure.
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
Unlocking Business Potential: Tailored Technology Solutions by Prosigns
Discover how Prosigns, a leading technology solutions provider, partners with businesses to drive innovation and success. Our presentation showcases our comprehensive range of services, including custom software development, web and mobile app development, AI & ML solutions, blockchain integration, DevOps services, and Microsoft Dynamics 365 support.
Custom Software Development: Prosigns specializes in creating bespoke software solutions that cater to your unique business needs. Our team of experts works closely with you to understand your requirements and deliver tailor-made software that enhances efficiency and drives growth.
Web and Mobile App Development: From responsive websites to intuitive mobile applications, Prosigns develops cutting-edge solutions that engage users and deliver seamless experiences across devices.
AI & ML Solutions: Harnessing the power of Artificial Intelligence and Machine Learning, Prosigns provides smart solutions that automate processes, provide valuable insights, and drive informed decision-making.
Blockchain Integration: Prosigns offers comprehensive blockchain solutions, including development, integration, and consulting services, enabling businesses to leverage blockchain technology for enhanced security, transparency, and efficiency.
DevOps Services: Prosigns' DevOps services streamline development and operations processes, ensuring faster and more reliable software delivery through automation and continuous integration.
Microsoft Dynamics 365 Support: Prosigns provides comprehensive support and maintenance services for Microsoft Dynamics 365, ensuring your system is always up-to-date, secure, and running smoothly.
Learn how our collaborative approach and dedication to excellence help businesses achieve their goals and stay ahead in today's digital landscape. From concept to deployment, Prosigns is your trusted partner for transforming ideas into reality and unlocking the full potential of your business.
Join us on a journey of innovation and growth. Let's partner for success with Prosigns.
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Globus
The Earth System Grid Federation (ESGF) is a global network of data servers that archives and distributes the planet’s largest collection of Earth system model output for thousands of climate and environmental scientists worldwide. Many of these petabyte-scale data archives are located in proximity to large high-performance computing (HPC) or cloud computing resources, but the primary workflow for data users consists of transferring data, and applying computations on a different system. As a part of the ESGF 2.0 US project (funded by the United States Department of Energy Office of Science), we developed pre-defined data workflows, which can be run on-demand, capable of applying many data reduction and data analysis to the large ESGF data archives, transferring only the resultant analysis (ex. visualizations, smaller data files). In this talk, we will showcase a few of these workflows, highlighting how Globus Flows can be used for petabyte-scale climate analysis.
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
The U.S. Geological Survey (USGS) has made substantial investments in meeting evolving scientific, technical, and policy driven demands on storing, managing, and delivering data. As these demands continue to grow in complexity and scale, the USGS must continue to explore innovative solutions to improve its management, curation, sharing, delivering, and preservation approaches for large-scale research data. Supporting these needs, the USGS has partnered with the University of Chicago-Globus to research and develop advanced repository components and workflows leveraging its current investment in Globus. The primary outcome of this partnership includes the development of a prototype enterprise repository, driven by USGS Data Release requirements, through exploration and implementation of the entire suite of the Globus platform offerings, including Globus Flow, Globus Auth, Globus Transfer, and Globus Search. This presentation will provide insights into this research partnership, introduce the unique requirements and challenges being addressed and provide relevant project progress.
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.