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
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
Scalars, Vectors, Matrices & Tensors — The Language of ML

If you're diving into Machine Learning, don't skip the basics! 💡
Understanding scalars, vectors, matrices, and tensors is crucial — they’re the building blocks of how data is represented and processed.

🔹 Scalar → A single number (like temperature: 36.6)
🔹 Vector → A list of numbers (like pixel values in a grayscale image row)
🔹 Matrix → 2D grid of numbers (like an image with width & height)
🔹 Tensor → Multi-dimensional array (think colored videos with time, RGB, height & width!)

From feeding input to a neural network to backpropagation — it's all tensors under the hood.

Master these, and you're speaking the native tongue of ML models.
You may see the code example for each of these elements:
https://aiwithphp.org/examples/mathematics/index
Read curefully:
https://apphp.gitbook.io/artificial-intelligence-with-php/machine-learning/mathematics-for-ml/linear-algebra
👍6
Using spaCy with PHP: Natural Language Processing in Your PHP Apps!

Did you know you can harness the power of spaCy (https://spacy.io) - one of Python’s most advanced NLP libraries - even in a PHP project? Here’s how! 👇

This library - spaCy - offers fast and accurate tokenization, named entity recognition, part-of-speech tagging, and more. While PHP isn’t natively built for NLP, you can bridge the gap with Python.

But, your may easily integrate spaCy with PHP
1. Create a Python script
Use spaCy to process text and output results as JSON. Example:

# nlp.py
import spacy
import sys
import json

nlp = spacy.load("en_core_web_sm")
text = sys.argv[1]
doc = nlp(text)

result = {
"tokens": [token.text for token in doc],
"entities": [(ent.text, ent.label_) for ent in doc.ents]
}
print(json.dumps(result))


2. Call the script from PHP

$text = "Elon Musk founded SpaceX in 2002.";
$escapedText = escapeshellarg($text);
$command = "python3 nlp.py $escapedText";
$output = shell_exec($command);
$result = json_decode($output, true);

print_r($result);
?>


That’s it! You now have spaCy-powered NLP inside your PHP app. It's perfect choice for chatbots, content tagging, semantic search, or anything involving language understanding.
👍4👏1
The most popular ML library in PHP reaches 1,000,000 downloads. Only last 24h - more than 10,000 - here we go!
👍4❤2🔥2