apphp/ai-with-php-examples

Code examples provided for the book Artificial Intelligence with PHP.

0.5.0 2025-03-14 14:04 UTC

This package is auto-updated.

Last update: 2025-03-14 20:04:38 UTC


README

https://apphp.gitbook.io/artificial-intelligence-with-php/

⚠️ 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

To install these examples, follow these steps:

  1. Clone the repository:
git clone git@github.com:apphp/ai-with-php-examples.git
  1. Navigate to the project directory:
cd ai-with-php-examples
  1. Run following command. It will prepare and run docker containers with all required applications.
make init
  1. After installation is complete, type in your browser: http://localhost:8088/
  2. If everything is OK, you should see the website with examples of code.

Live DEMO

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

Libraries for Backend

Libraries for UI

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
      • Practical Applications
    • Knowledge & Uncertainty in AI
      • Knowledge-Based Agents
    • AI Agents
      • LLM Agents
        • Site Status Checker Agent
        • Sales Analyst Agent
  • 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