PHPackages                             apphp/ai-with-php-examples - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. apphp/ai-with-php-examples

ActiveProject[Utility &amp; Helpers](/categories/utility)

apphp/ai-with-php-examples
==========================

Code examples provided for the book Artificial Intelligence with PHP.

0.6.0(1y ago)20MITPHPPHP ~8.2.0CI passing

Since Nov 22Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/apphp/ai-with-php-examples)[ Packagist](https://packagist.org/packages/apphp/ai-with-php-examples)[ RSS](/packages/apphp-ai-with-php-examples/feed)WikiDiscussions main Synced today

READMEChangelog (5)Dependencies (13)Versions (8)Used By (0)

Examples for AI with PHP Learning Book
--------------------------------------

[](#examples-for-ai-with-php-learning-book)

[](https://apphp.gitbook.io/artificial-intelligence-with-php/)

Interact With The Community
---------------------------

[](#interact-with-the-community)

- [Join Our Telegram Channel](https://t.me/aimlphp)

**⚠️ Disclaimer**
-----------------

[](#️-disclaimer)

The code examples provided for the book *Artificial Intelligence with PHP* are intended for educational purposes only. These examples are designed to illustrate concepts and techniques in artificial intelligence and machine learning using PHP. **They are not suitable for production use and should not be deployed on live servers or systems that handle sensitive data.**

The demo code has not been subjected to rigorous security testing and may contain inaccuracies, vulnerabilities, inefficiencies, or other issues that could pose security risks if used in production environments. As such, it may not be 100% accurate or reflect best practices. We strongly advise readers to thoroughly review, test, and secure any implementation of the techniques demonstrated in this book before using them in real-world applications.

**The author and publisher are not responsible for any security breaches, data losses, or other damages that may result from using these examples on production servers.**

**Installation**
----------------

[](#installation)

To install these examples, follow these steps:

1. Clone the repository:

```
git clone git@github.com:apphp/ai-with-php-examples.git

```

3. Navigate to the project directory:

```
cd ai-with-php-examples

```

4. Run following command. It will prepare and run docker containers with all required applications.

```
make init

```

4. After installation is complete, type in your browser:
5. If everything is OK, you should see the website with examples of code.

Live DEMO
---------

[](#live-demo)

You may find live demo for these examples on official website: [](https://aiwithphp.org/examples/)

Libraries for Backend
---------------------

[](#libraries-for-backend)

- Rubix ML
- RubixML/Tensor
- PHP-ML
- MathPHP
- OpenAI PHP Client
- LLM Agents PHP SDK

Libraries for UI
----------------

[](#libraries-for-ui)

- Chart.js
- Plotly.js
- Mermaid.js
- MathJax
- Regression-js
- React and ReactDOM
- Babel for JSX transformation
- JavaScript syntax highlighter

The Following Examples are Available:
-------------------------------------

[](#the-following-examples-are-available)

- Artificial Intelligence

    - Problem Solving
        - Uninformed (Blind) Search
            - Breadth-First Search (BFS)
            - Depth-First Search (DFS)
            - Iterative Deepening Depth-First Search (IDDFS)
            - Uniform Cost Search (UCS)
            - Bidirectional Search (BDS)
            - Depth-Limited Search (DLS)
            - Random Walk Search (RWS)
        - Informed (Heuristic) Search
            - Greedy Search
            - A\* Tree Search
            - A\* Graph Search
            - Iterative Deepening A\*
            - Beam Search
            - Hill Climbing Search
            - Simulated Annealing Search
        - Practical Applications
            - Traveling Salesman Problem
            - Simulated Annealing Process
    - AI Agents
        - LLM Agents
            - Site Status Checker Agent
            - Sales Analyst Agent
    - Knowledge &amp; Uncertainty in AI
        - Knowledge-Based Agents
    - Mathematics for AI
        - Logic and Reasoning
            - Propositional
            - Predicate Logic
- Machine Learning

    - Mathematics for ML
        - Scalar
            - Scalar Operations with MathPHP
            - Scalar Operations with Pure PHP
        - Vector
            - Vector Operations with Rubix
            - Vector Operations with Rubix/Tensor
            - Vector Operations with MathPHP
            - Vector Operations with Pure PHP
        - Matrices
            - Matrix Operations with Rubix
            - Matrix Operations with Rubix/Tensor
            - Matrix Operations with MathPHP
            - Matrix Operations with Pure PHP
        - Tensors
        - Linear Transformations
            - Scale Transformation
            - Simple Linear Layer
            - Fully Connected Layer
            - ReLU Activation
        - Eigenvalues and Eigenvectors
    - Data Fundamentals
        - Big Data Techniques in PHP
            - Chunked Processing
            - Dataset Generator
    - Stages of Data Processing
        - Data Cleaning
            - Data Cleaning
            - Data Normalization
            - Data Standardization
        - Data Transformation
            - Encoding Categorical Variables
            - Normalizing and Scaling Numerical Features
            - Reshaping Data Structures
    - ML Algorithms
        - Linear Regression
            - Simple Linear Regression
            - Multiple Linear Regression
            - Regularized Linear Regression (Lasso)
        - Polynomial Regression
- Neural Networks

    - Types of NN
        - Basic Neural Network
            - Simple Perceptron

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance49

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~38 days

Recently: every ~47 days

Total

7

Last Release

356d ago

PHP version history (2 changes)0.1.0PHP ~8.3.0

0.5.0PHP ~8.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9803e512c3636b0cfa0224e247621e178ad0fe34f399a413be9b63148f636b70?d=identicon)[apphp](/maintainers/apphp)

---

Top Contributors

[![apphp](https://avatars.githubusercontent.com/u/5477692?v=4)](https://github.com/apphp "apphp (403 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/apphp-ai-with-php-examples/health.svg)

```
[![Health](https://phpackages.com/badges/apphp-ai-with-php-examples/health.svg)](https://phpackages.com/packages/apphp-ai-with-php-examples)
```

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

23.9k69.5k](/packages/grumpydictator-firefly-iii)[contao/core-bundle

Contao Open Source CMS

1231.6M2.8k](/packages/contao-core-bundle)[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.5k10](/packages/helsingborg-stad-municipio)[sproutcms/cms

Enterprise content management and framework

242.5k4](/packages/sproutcms-cms)[blackfire/player

A powerful web crawler and web scraper with Blackfire support

49617.1k](/packages/blackfire-player)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
