AI & ML with PHP
44 subscribers
10 photos
39 links
This channel is intended for developers, who interesting in using AI and ML with PHP.
Download Telegram
PHP has been a leader in web development for decades, but its potential for artificial intelligence remains unexplored.
I think now is the time to start widely use PHP language with AI and Machine Learning, as there is a great demand for it on the internet and... here we go!
Let's start from understanding what exactly AI is and it's structure.
πŸ‘2πŸ’―1
When you speak about AI you have to take in account, that AI consists of various specialized fields, each focusing on different aspects of creating intelligent machines.
Here are some of the key areas of AI:

πŸ”Ή Machine Learning (ML)
Algorithms that enable machines to learn from data and make predictions. Used in recommendation systems, image recognition, and fraud detection.

πŸ”Ή Neural Networks & Deep Learning (DL)
Models inspired by the human brain that can analyze complex patterns. Essential for image and speech recognition, as well as autonomous systems.

πŸ”Ή Natural Language Processing (NLP)
Teaches machines to understand, interpret, and generate human language. Powers chatbots, translation tools, and voice assistants.

πŸ”Ή Computer Vision
Enables machines to interpret and understand visual data. Used in facial recognition, autonomous vehicles, and medical imaging.

πŸ”Ή Robotics
Combines AI with engineering to create robots that can navigate, perceive, and interact with their environment. Applied in manufacturing, healthcare, and space exploration.

πŸ”Ή Cognitive Computing
Simulates human thought processes, allowing machines to learn, reason, and understand language. Used in pattern recognition, data mining, and intelligent assistants.

πŸ”Ή Expert Systems
AI-driven systems that replicate human decision-making using rule-based knowledge. Useful in medical diagnosis, finance, and technical troubleshooting.

πŸ”Ή AI Ethics & Safety
Focuses on the ethical considerations and risks of AI, including bias, transparency, and the societal impact of automation.

So... as you understand, AI is not only GPT chat, it is much more ))
πŸ‘6
I believe we are now at the beginning of a new era β€” the Era of AI Agents! Just imagine, 30-40 years ago, we started with functional programming, then for many years, we used OOP, DDD, BDD, and many other cool and funny approaches. Now, a new programming paradigm comes β€” LLM AI Agents Driven Design.

Check out this introduction to LLM AI PHP Agents and think about the future of AI-driven development!
πŸ‘4
It's important to know (for better understanding), that AI can be categorized based on what it can do and how it works. Let’s break it down!

🧠 Type 1: Based on Capabilities
1. Weak AI (Narrow AI) – Focuses on a specific task, like Siri, self-driving cars, or image recognition (already among us).
2. General AI (Strong AI) – Would think and learn like a human, but we haven’t built it yet (still not).
3. Super AI – Smarter than humans in every way, but purely theoretical for now (e.g., Skynet - still not, 10xG-d!).

βš™οΈ Type 2: Based on Functionality
1. Reactive Machines – Only respond to situations based on programming (e.g., IBM Deep Blue, AlphaGo, iRobot, etc).
2. Limited Memory AI – Uses past data for short-term decision-making (e.g., self-driving cars).
3. Theory of Mind AI – Would understand human emotions and interact socially (still in development).
4. Self-Awareness AI – Would have its own consciousness and emotions (a future possibility).

The most important that AI is constantly evolving (faster than we are)...
πŸ‘5
Machine Learning: How Computers Learn Like Humans!

Did you ever wonder how Netflix recommends shows you love or how Siri understands your voice? That’s Machine Learning in action! It’s a subset of AI that helps computers learn from data and make smart decisions β€” just like you and me do!

How Machine Learning Works
- Collect Data: You gather a set of data related to the problem you want to solve.
- Train the Model: The machine learning algorithm uses this data to learn patterns. During training, the model adjusts its internal parameters to improve its accuracy.
- Test the Model: After training you test the model on new data to see if it can make good predictions.
- Make Predictions: Once trained and tested, the model can predict outcomes on new, unseen data.

Unlike traditional programming, where every rule is manually coded, Machine Learning adapts and improves over time!

Next time we'll talk about which kind of problems can be better solved with machine learning and present popular PHP libraries for ML.
πŸ‘9
PHP is not Python, but that doesn't mean it can't be used for machine learning and scientific computing!

There are many legacy PHP libraries that were started 7-10 years ago, were abandoned most likely due to Python and are no longer supported, so I have listed only the most current and actively developed ones (thanks to the loyal PHP community).

Below you may find some of the most powerful libraries available for PHP.

Machine Learning Libraries

πŸ”Ή Rubix ML – One of the most powerful ML libraries for PHP.
- Supports more than 40+ supervised and unsupervised algorithms (neural networks, decision trees, clustering).
- Includes data transformation, pipelines, and model evaluation tools. Official website: https://rubixml.com

Mathematical Libraries (for Scientific Computing)

πŸ”Ή NumPower – A PHP alternative to NumPy!
- High-performance numerical computing with GPU acceleration.
- Supports multi-dimensional arrays and linear algebra operations.
Official website: https://numpower.org

πŸ”Ή MathPHP – A modern mathematics library for PHP.
- Pure PHP with no external dependencies.
- Offers a wide range of mathematical functions.
Official website: https://github.com/markrogoyski/math-php

πŸ”Ή RubixML/Tensor – A high-performance tensor and matrix operations library for PHP.
- Optimized for speed using PHP’s native extensions.
- Provides essential linear algebra tools for scientific computing and ML.
Github: https://github.com/RubixML/Tensor

If you are interested in using RubixML in your projects, you can find many video tutorials on youtube. Here is just one example: https://www.youtube.com/watch?v=zJc_Vju72dg
πŸ‘8
If you want to build a career in AI, ML or Big Data

The world of AI, ML and Big Data is growing every day, and if you want to dive into Data & AI, it's important to choose the right path. It's not so simple to decide: who to become? Let's check which options are available today for your choice:

1. Data Scientist – the AI magician πŸ§™β€β™‚οΈ who builds machine learning models, analyzes data, and makes predictions. Key skills: Python, statistics, ML, SQL, C.
2. Data Analyst – the data detective πŸ” who digs deep into numbers, creates reports, and finds hidden patterns. Tools of choice: PHP, SQL, Excel, BI systems (Tableau, Power BI), etc.
3. Data Engineer – the data architect πŸ—οΈ who designs and maintains data pipelines and storage. Must-know: Python, SQL, Spark, ETL, databases.
4. ML Engineer – the model optimizer πŸš€ who takes machine learning from theory to production. Required skills: PHP, Python, TensorFlow/PyTorch, DevOps, MLOps.
5. AI Enthusiast – the explorer 🌍 who experiments with AI, joins Kaggle competitions, and builds cool projects just for fun. Required skills: PHP, Python, JS, databases. etc.

Which role suits you best?
✍3πŸ‘3
What to read?

I'm planning to post here information about books, articles or other interesting materials related to AI or ML. This is the first one. So.. Get it:

Andriy Burkov, The Hundred-Page Language Models Book
https://themlbook.com/

This book provides a practical guide to get started and execute on machine learning within a few days without necessarily knowing much about machine learning.

βœ… Pros
1. Straight to the Point – The book explains machine learning ideas quickly and clearly without extra details. This makes it great for busy people.
2. Easy for Beginners – It gives a simple introduction to machine learning, so newcomers won’t feel lost.
3. Includes Some Math – It covers important math concepts like probability and algebra, but it doesn’t go too deep.
4. Helpful for Interviews – If you're preparing for a machine learning job interview, this book is a great refresher.
5. Covers Old and New ML Methods – It talks about basic models like decision trees and modern AI like deep learning.

❌ Cons
1. Too Short for Deep Learning – The book moves very fast, so you might need another book for more details.
2. Not Many Code Examples – It explains ML well but doesn’t show much actual coding. If you want hands-on practice, you'll need another resource.
3. Some Prior Knowledge Helps – While it’s good for beginners, a basic understanding of math and ML will make it easier to follow.

πŸŽ“ The Verdict
This book is like a pocket-sized AI mentor β€” super useful, incredibly insightful, and refreshingly brief. But if you're looking for deep, hands-on coding exercises or advanced ML theory, you'll need something else.
Not sure if you're ready to buy it? Read this first: https://themlbook.com/wiki/doku.php
πŸ‘5πŸ‘1
AI-Powered PHP Agents in Action!

If you’re a PHP developer looking to add AI to your projects, the LLM Agents PHP SDK makes it super easy. You can build smart agents that automate tasks, analyze data, and interact with external toolsβ€”all with minimal effort.

Here are two cool real examples, see live demo with code example:

πŸ”Ή Site Status Checker – Monitors website uptime and performance, instantly notifying you of any issues.
https://aiwithphp.org/examples/ai-agents/llm-agents/site-status-checker-agent-run

πŸ”Ή Sales Analysis Agent – Analyzes sales data, spots trends, and helps businesses make better decisions.
https://aiwithphp.org/examples/ai-agents/llm-agents/sales-analysis-agent-run

P.S. The result is cached, so if you want to install this code examples on your server, you should use your own OpenAI key.
πŸ‘4
Problem Solving in AI

Search algorithms in AI are designed to assist in identifying the best solution to a problem. A search problem typically consists of a search space, an initial state, and a goal state.

Generally we have following types of searches:
- Uninformed Search: Requires no additional information beyond the problem definition.
- Informed Search: Utilizes heuristics or additional knowledge to improve efficiency.
- Global Search: Explores the entire problem space systematically or with guidance (e.g., BFS, A*). These algorithms are more exhaustive but computationally expensive.
- Local Search: Focuses on improving solutions in a specific area without exploring the entire space (e.g., Hill Climbing, Simulated Annealing). These algorithms are more efficient for large spaces but may miss the optimal solution.

Live Demos:
https://aiwithphp.org/examples/problem-solving/index
πŸ‘5
News: OpenAI introduced a new level of image generation.

OpenAI has launched a better image generation tool in ChatGPT, using the new GPT-4o model. One big change is that this feature is now available not only for paid users (Plus, Pro, Team), but also for free users, who can generate up to 3 images per day.

The new generator is much better than the previous version, which used DALL-E 3. It understands more complex requests, shows text on images correctly, and creates images in a clear order – from left to right and top to bottom. At the same time, users can still access the old DALL-E 3 generator.

See the result for simple prompt "generate image where PHP programmer explains AI & ML for PHP
πŸ‘6❀2
Will there be a 3rd AI Winter? Is this possible at all?

Doesn't it seem too early for such questions?

I think there could be a 3rd AI winter after this big boom with large language models (LLMs), like ChatGPT, but it might not be as serious as the ones in the past. The LLM boom (GPT-4, Claude, Gemini, etc.) has raised expectations sky-high, and that's usually the perfect setup for disillusionment. Although the context today is very different from the '70s and '80s.

In the past, AI winters happened when people expected too much from AI and got disappointed. I feel like the same thing might happen now. Many people believe LLMs can do everything β€” replace humans, solve all problems β€” but that's not really true. If companies will spend a lot of money on AI and don't see good results, they might stop investing.

Also, if AI makes mistakes, causes bias, or is used in the wrong way, governments might bring in strong rules. That could slow down AI development. Another problem is that training these big models takes a lot of money and energy, which isn't sustainable forever.

On the other hand, I don't think we'll have a complete AI winter. AI is already in so many tools people use every day β€” like search engines, writing assistants, and coding tools. And it's not just about LLMs; there's also progress in robotics, computer vision, and smaller, open-source models. That means innovation won't stop completely.

So in my opinion, we might see a slowdown β€” something like an AI autumn, not a full winter. Some companies might shut down or change direction, but AI will still move forward, just in a more realistic and useful way.

But when exactly? May be next year, may be later. Sorry, but I don't really know... 😜
πŸ‘1
πŸ‘3πŸ€”2
OMG! Sam Altman was right and I'm wrong...

Today, the first time I editied my previously written code with Chat GPT directly without copy-paste by voice command.
Ream more: https://help.openai.com/en/articles/10119604-work-with-apps-on-macos

When working with IDEs, you can ask ChatGPT to edit open files directly β€” no copy-pasting required. When you ask for an edit, ChatGPT will generate a diff that you can review and apply, and there’s also an option to automatically apply edits. Diffs are easy to revert in the ChatGPT UI, or by using CMD+Z in your editor.
πŸ‘6
Machine Learning Capabilities in PHP
Yes, I do and I use it in my projects.

When people talk about machine learning, PHP rarely comes up. Python and R dominate the conversation β€” and for good reason. But here’s an interesting fact: PHP still powers nearly 75% of the web (https://w3techs.com/technologies/details/pl-php), and in recent years, it’s been quietly gaining machine learning capabilities.

Why should you, PHP developer, care?
Because now you can build smarter web apps β€” like recommendation engines, predictive analytics, or spam filters β€” without leaving PHP.

Here are some PHP libraries bringing ML to the table:

πŸ”Ή Rubix ML (https://rubixml.com) – A modern, production-ready library with support for neural networks, decision trees, clustering, and more. It also includes tools for data prep and evaluation.

πŸ”Ή PHP-ML (https://php-ml.readthedocs.io) – One of the first full-featured ML libraries in PHP. Offers popular algorithms like k-NN and SVM. Ideal for adding basic ML features without deep expertise.

But it doesn’t stop there. PHP is also getting stronger in scientific computing:

β–ͺ️ NumPower (https://numpower.org) – A high-performance extension with GPU acceleration via CUDA. Comparable to NumPy in Python.

β–ͺ️ MathPHP (https://github.com/markrogoyski/math-php) – A robust math library written entirely in PHP. No external dependencies.

β–ͺ️ RubixML/Tensor (https://github.com/RubixML/Tensor) – Provides fast tensor and matrix operations, optimized for PHP-based data science.

Interesting fact: RubixML and Tensor are written in native PHP, proving that you don’t need Python to get decent ML performance β€” especially for web-scale problems.

Want to connect with more powerful ML tools?
You can combine PHP with TensorFlow.js or Brain.js. These run in the browser (JavaScript) and send results back to your PHP backend β€” great for hybrid web apps.

Of course, PHP may not be the first choice for machine learning, but it's growing quietly in that space. For us, PHP developers, that means we can add intelligence to our apps using the tools we already know.
πŸ‘4
Last Trend for PHP + AI. May be this is new upward trend line? Who knows...
πŸ€”3πŸ‘1
The MCP protocol (Message Control Protocol) plays a crucial role in enhancing communication with Large Language Models (LLM). MCP ensures reliable message exchange by managing message formatting, transmission, and error handling. This becomes particularly beneficial when interacting with LLM models.

See this video about MCP. Just few minutes of very high quality content, explaining what is MCP.
https://www.youtube.com/watch?v=qPVtVulhFC4
πŸ‘6
Windsurf Wave 7: Cascade Comes to JetBrains!

Great news! Windsurf (formerly Codeium) has launched Wave 7, bringing the full Cascade AI experience to JetBrains IDEs like IntelliJ, PhpStorm, WebStorm, and PyCharm.
https://windsurf.com/blog/windsurf-wave-7

Now you can:
βœ… Use Write, Chat, and Legacy modes
βœ… Access all Cascade tools inside the editor
βœ… Work with AI directly in your terminal
βœ… Enjoy a smooth agent-based coding flow

This is a big step for AI coding tools in JetBrains. And more features are coming soon!

🌊 It’s all Windsurf now β€” one name, one platform, full AI power for your PHP+ projects!
πŸ”₯6πŸ‘2❀1