Skip to content

apphp/awesome-php-ml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

216 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Awesome PHP Machine Learning & AI

Awesome GitHub stars Resources Last commit License Link Check

The most comprehensive curated list of Machine Learning, Artificial Intelligence, NLP, LLM and Data Science libraries for PHP.

Inspired by awesome-php and the broader Awesome ecosystem.

Goal: make it easy to build intelligent systems with PHP β€” from classic ML to modern LLM-based workflows.

Want to add a project? See the Contributing section below for inclusion criteria and submission guidance.

Contents


Requirements

PHP Version Requirements:

  • Minimum: PHP 7.4+ (most libraries already support PHP 8.1+/8.2+)
  • Recommended: PHP 8.1+ for best performance and features
  • Latest features: PHP 8.2+ for some cutting-edge libraries

Common dependencies:

  • Extensions: mbstring, curl, json, gd (for image processing)
  • Optional: redis, pdo_pgsql (for vector search), ffi (for native bindings)

Memory considerations:

  • Basic ML: 256MB+ RAM
  • Neural networks: 512MB+ RAM
  • Large datasets: 1GB+ RAM recommended

What is this?

  • Curated list of PHP libraries and tools for Machine Learning, AI, NLP, LLMs and Data Science.
  • Focused on code-first resources: packages, SDKs, frameworks, and building blocks.
  • Aimed at PHP developers who want to add intelligent features to existing apps or build new AI-powered systems.

How to use this list

Quick Start

For beginners new to PHP ML/AI:

# Install a core ML library
composer require rubix/ml
composer require php-ai/phpml

# Install LLM client
composer require openai-php/client

# Install vector search for RAG
composer require llphant/llphant

Basic examples:

  • Classification: Use RubixML/RubixML with KNearestNeighbors for simple classification tasks
  • LLM integration: Use openai-php/client to call GPT models from PHP
  • Text analysis: Use php-ai/php-ml for sentiment analysis and tokenization
  • Vector search: Use LLPhant/LLPhant with pgvector for semantic search

Example "recipes"

Recommended core stack

These are opinionated defaults you can reach for when you just want something that works in production.

Legend

Not all projects are tagged yet – we're gradually adding markers as the ecosystem evolves. Treat them as rough guidance, not strict rules.

  • 🌟 – widely used / production-ready projects
  • πŸ§ͺ – experimental or research-oriented projects
  • ⚠️ – projects with limited maintenance, older APIs, or niche usage; review before using in new projects

Machine Learning

Core PHP libraries for supervised/unsupervised learning, classification, regression, and clustering.

  • 🌟 CodeWithKyrian/transformers-php – GitHub stars A PHP toolkit for running Hugging Face–style Transformer models with ONNX Runtime (text generation, summarization, classification, etc.)
  • ⚠️ danielefavi/brainy – Simple PHP class for neural networks and machine learning
  • dr-que/polynomial-regression – Polynomial regression for PHP
  • ⚠️ pecl/svm – PHP extension providing bindings to the LIBSVM library for Support Vector Machine classification and regression
  • 🌟 php-ai/php-ml – Core machine learning algorithms for PHP
  • php-ai/php-ml-examples – Practical examples for PHP-ML
  • sphamster/bayes – Naive Bayes classifier implementation in PHP for probabilistic classification tasks

Deep Learning & Neural Networks

PHP libraries for neural networks, deep learning architectures, and advanced learners built on tensors.

  • πŸ§ͺ rindow/rindow-neuralnetworks – Deep learning framework for PHP providing neural network layers, training utilities, and GPU/accelerated backends via the Rindow numerical computing ecosystem
  • 🌟 RubixML/RubixML – GitHub stars High-level ML framework with pipelines and datasets

Natural Language Processing

Text processing, tokenization, language detection, sentiment analysis and other NLP tasks in PHP.


Computer Vision, Image & Video Processing

Image manipulation, preprocessing, and computer vision workloads from PHP.

  • πŸ§ͺ aschmelyun/subvert - Generate subtitles, summaries, and chapters from videos in seconds
  • 🌟 Intervention/image – GitHub stars Image manipulation library for CV preprocessing
  • jcupitt/vips – Fast image processing library with PHP bindings
  • πŸ§ͺ mailmug/php-dlib – PHP extension for Dlib, supporting face detection, facial landmarks, face recognition descriptors, CNN detection, and clustering
  • πŸ§ͺ php-opencv/php-opencv – OpenCV bindings for PHP

Math, Statistics & Linear Algebra

Numerical computing, matrix operations, statistics, and related math foundations for ML and data science in PHP.

  • 🌟 brick/math – GitHub stars Arbitrary-precision arithmetic for PHP (BigInteger, BigDecimal, BigRational)
  • 🌟 Hi-Folks/statistics – GitHub stars Probability distributions and statistical functions library for PHP
  • 🌟 markrogoyski/math-php – GitHub stars Math library for linear algebra, statistics, and calculus
  • mcordingley/LinearAlgebra – Stand-alone linear algebra library
  • ⚠️ NumPHP/NumPHP – Math library for scientific computing

Core ML Infrastructure

Low-level building blocks for numerical computing, tensors, and model execution in PHP.

Numerical computing & tensors

  • 🌟 RubixML/Tensor – GitHub stars N-dimensional tensors for numerical computing
  • 🌟 RubixML/numpower – High-performance numerical computing library inspired by NumPy
  • πŸ§ͺ rindow/rindow-math-matrix – Foundational package for scientific matrix operations
  • πŸ§ͺ phpmlkit/ndarray – Multidimensional array (ndarray) implementation for PHP inspired by NumPy, useful for numerical computing and machine learning workloads

Model execution & runtimes

  • 🌟 ankane/onnxruntime-php – GitHub stars Run ONNX models from PHP
  • FFI – Native C/C++ bindings in PHP for high-performance ML inference
  • phpmlkit/onnxruntime – High-performance ONNX Runtime bindings for PHP using FFI, enabling inference of models from PyTorch, TensorFlow, scikit-learn and other frameworks

Interoperability

  • 🌟 swoole/phpy – GitHub stars Bridge for calling Python from PHP via a runtime bridge

Ecosystems

  • phpmlkit (GitHub org) – Collection of high-performance ML infrastructure libraries for PHP, including NDArray (NumPy-like arrays) and ONNX Runtime bindings

LLMs & AI APIs

Clients, SDKs, and frameworks for calling hosted LLMs and other AI providers from PHP.

  • aiaccess/ai-access – Unified PHP AI client providing a consistent interface for multiple providers (OpenAI, Anthropic, Gemini, DeepSeek, Grok) with support for chat, embeddings, batch processing, and provider switching
  • πŸ§ͺ adrienbrault/instructrice – Typed LLM outputs in PHP with flexible schema support (OpenAI, Claude, Gemini, etc.) and type-safe handling of structured responses
  • ArdaGnsrn/ollama-php – A PHP client library for the Ollama LLM server, enabling completions, chat, model management, and embeddings via Ollama's API
  • Clarifai/clarifai-php-grpc – Official Clarifai gRPC PHP client for accessing Clarifai's AI APIs (vision and text recognition)
  • cognesy/instructor-php – Structured-output helper for LLM responses
  • deepseek-php/deepseek-php-client – PHP client library for integrating with the DeepSeek AI API, providing a fluent API for model queries, streaming results, and support for multiple HTTP clients and models
  • 🌟 dtyq/magic – GitHub stars Open-source enterprise AI agent platform with generalist agents, workflow orchestration, IM integration, collaborative office features, and support for multiple LLMs
  • elastic/elasticsearch-chatgpt-php – Experimental PHP library that uses ChatGPT to translate natural language into Elasticsearch DSL queries and perform semantic search over your indices
  • FunkyOz/mulagent – Multi-agent orchestration framework for LLM applications
  • 🌟 google-gemini-php/client – GitHub stars Gemini PHP is a community-maintained PHP API client that allows you to interact with the Gemini AI API
  • ⚠️ HosonoDE/EasyAI-PHP – High-level AI integration library for PHP that simplifies using LLMs
  • πŸ§ͺ carmelosantana/php-agents – PHP framework for building AI agents with tool use, provider abstraction and multi-model support
  • 🌟 kambo-1st/langchain-php GitHub stars A PHP port of the LangChain framework for building composable LLM-powered applications
  • 🌟 llm-agents-php/agents – GitHub stars LM Agents is a PHP library for building and managing Language Model (LLM) based agents
  • llm-agents-php/prompt-generator – Prompt generator for LLM agents with interceptors
  • ModelFlow-AI (GitHub org) – Collection of PHP packages for unified access to AI models, embeddings, and chat (OpenAI, Mistral, Ollama)
  • mozex/anthropic-php – Community-maintained PHP API client for the Anthropic (Claude) AI API, supporting messages, streaming, tool use, and batch processing
  • mzarnecki/php-rag – PHP RAG toolkit for connecting vector search and LLMs in retrieval-augmented workflows
  • 🌟 openai-php/client – GitHub stars Official OpenAI PHP client
  • 🌟 orhanerday/open-ai – GitHub stars Popular OpenAI PHP SDK
  • prism-php/bedrock – AWS Bedrock provider for the Prism PHP framework, adding Bedrock LLM and embeddings support to Laravel Prism integrations
  • sarfraznawaz2005/ai-team – Package to build and run collaborative teams of AI members with role/task assignments
  • SearchAugmentedLLM – PHP search-augmented LLM tool that performs web search, extracts, chunks and ranks content to provide context for LLM responses (ideal for RAG applications)
  • skito/aipi-php – Universal API client for common AI models in PHP, offering a unified interface to interact with multiple LLM providers
  • softcreatr/php-mistral-ai-sdk – PHP SDK for the Mistral AI API, providing an easy wrapper to call Mistral's LLM and AI endpoints (chat, embeddings, fine-tuning etc.)
  • takaaki-mizuno/php-llm-json-adapter – Adapter to normalize and return LLM responses as structured JSON using JSON Schema, with support for multiple providers (OpenAI, Gemini, Bedrock, Ollama)
  • thojou/php-llm-documents – PHP library for LLM-based document processing (splitting, embeddings, vector store, search) inspired by LangChain/DocTran
  • utopia-php/agents – Simple, lightweight PHP library for AI agent orchestration with multi-provider support (OpenAI, Anthropic, Deepseek, Perplexity, XAI)

Agents & Tooling / MCP

  • logiscape/mcp-sdk-php – PHP SDK for building Model Context Protocol (MCP) clients and servers to connect LLMs with external tools and services
  • πŸ§ͺ manuelkiessling/php-ai-tool-bridge – PHP library for defining AI β€œtool functions” that let LLMs interact with application code and external services using structured JSON schemas
  • prism-php/relay – MCP client for Prism that lets PHP/Laravel AI agents connect to external Model Context Protocol servers and use their tools
  • πŸ§ͺ symfony/mcp-sdk – Symfony's experimental PHP SDK for building Model Context Protocol (MCP) clients and servers

Speech & Text-to-Speech

  • b7s/fluentvox – Fluent PHP API for state-of-the-art text-to-speech and voice cloning (Resemble AI's Chatterbox), with CLI, GPU acceleration, and multilingual support
  • b7s/whisper-php – PHP wrapper/client for Whisper speech-to-text (ASR), enabling audio transcription via Whisper models

Tokenizers & Prompt Utilities

  • CodeWithKyrian/tokenizers-php – PHP bindings for Hugging Face Tokenizers, enabling fast tokenization for transformer and LLM models
  • Gioni06/GPT3Tokenizer – PHP tokenizer compatible with GPT-3 style models
  • HelgeSverre/toon-php – PHP implementation of TOON, a compact data format for reducing token usage when sending structured data to LLMs
  • yethee/tiktoken-php – PHP implementation of OpenAI's tiktoken tokenizer for token counting and optimization

Embeddings & Vector Search

Libraries for generating embeddings and performing vector similarity search from PHP applications.


Data Processing

ETL, data pipelines, serialization, and transformation utilities for preparing data for ML and analytics in PHP.


Interop & Model Serving

Bridging PHP with native libraries, external services, and runtimes for deploying and serving ML and LLM models.

  • 🌟 deepl-php – GitHub stars Official PHP client library for the DeepL API, enabling high-quality language translation via DeepL's AI/ML service
  • distantmagic/resonance – Asynchronous PHP framework (Swoole-based) for building AI-powered, IO-intensive applications, with built-in web server, LLM integration (llama.cpp), WebSockets, and ML model serving capabilities
  • FFI – Native C/C++ bindings for ML inference
  • πŸ§ͺ garyblankenship/mcp-php – PHP example of a Model Context Protocol (MCP) server for connecting LLMs with application logic
  • 🌟 googleapis/google-cloud-php – GitHub stars Official PHP client library for Google Cloud APIs (including ML/AI services like Vision, Translate, AutoML, Vertex AI, etc.)
  • grpc/grpc-php – gRPC client for model services
  • πŸ§ͺ HossamBalaha/Deep-Learning-Classification-System-using-PHP-and-Keras – Example system showing how to integrate a Keras deep learning classifier with a PHP backend
  • 🌟 neuron-core/neuron-ai – GitHub stars PHP agentic AI framework for building and orchestrating LLMs, RAG etc
  • nlpcloud/nlpcloud-php – PHP client for the NLP Cloud API (access NLP/ML services like NER, sentiment analysis, summarization, text generation, embeddings, translation, and more)

Tools & Utilities

Supporting tools, debugging helpers, logging, and HTTP/CLI utilities commonly used in ML and AI workflows.

  • πŸ§ͺ apphp/pretty-print – Pretty-print PHP arrays and numeric data for ML debugging
  • πŸ§ͺ context-hub/generator – Context-as-Code (CTX) tool that extracts and organizes codebase context into structured documents and MCP servers for LLM-assisted development
  • guanguans/ai-commit – AI-powered CLI to automatically generate conventional Git commit messages
  • joshembling/laragenie – AI chatbot/assistant for Laravel that indexes and understands your codebase via the command line (OpenAI + Pinecone)
  • πŸ§ͺ mariorazo97/single-file-php-ai – Drop-in single-file PHP AI chat interface for Ollama and OpenAI, with no Node.js, Docker, database, or build step
  • nunomaduro/collision – CLI error handling (useful for ML tools)
  • psr/log – Logging standard
  • symfony/console – CLI applications
  • symfony/http-client – Robust HTTP client for AI APIs

Laravel & Framework Integrations

LLM & AI clients

  • artisan-build/llm – Laravel integration for multiple LLM providers (OpenAI, Azure, OpenRouter, etc.), simplifying usage of large language models in Laravel apps
  • BorahLabs/LLM-Port-Laravel – Laravel package for interchangeable LLM providers, allowing drop-in replacements of large language models
  • Capevace/llm-magic – Laravel-centric LLM toolkit with support for AI features like chat and structured data extraction
  • coding-wisely/taskallama – Laravel package for seamless integration with the Ollama LLM API for AI-powered content generation, task assistance, conversation and embeddings
  • grok-php/laravel – Laravel package for integrating Grok AI models
  • 🌟 laravel/ai – GitHub stars The Laravel AI SDK: a unified, expressive Laravel API for interacting with AI providers (LLMs, images, embeddings, agents, tools)
  • 🌟 laravel/boost – GitHub stars Official Laravel Boost: a development server and AI context provider that accelerates AI-assisted code generation by giving AI tools detailed insight into your Laravel app (MCP server, schema inspection, docs + guidelines)
  • maestroerror/laragent – AI agent development framework for Laravel: define agents, tools, workflows, and manage LLM interactions with an Eloquent-style API
  • moe-mizrak/laravel-openrouter – Laravel package to integrate OpenRouter LLM API
  • mozex/anthropic-laravel – Laravel integration for the Anthropic (Claude) AI API with Facades, config publishing, and testing fakes
  • 🌟 neuron-core/neuron-laravel – GitHub stars Laravel integration for Neuron Core to build and orchestrate AI/LLM workflows
  • atlas-php/atlas – Laravel AI application framework for structuring agents, tools, prompts, and pipelines on top of Prism PHP
  • 🌟 openai-php/laravel – GitHub stars Laravel OpenAI integration
  • opgginc/laravel-mcp-server – Laravel package for building secure Model Context Protocol (MCP) servers using Streamable HTTP/SSE, enabling real-time communication between LLM agents and application tools
  • PapaRascal2020/sidekick – Laravel package offering a unified syntax for working with multiple AI provider APIs (OpenAI, Claude, Cohere, Mistral)
  • 🌟 php-mcp/laravel – GitHub stars – Laravel package for building Model Context Protocol (MCP) servers and exposing application tools to LLMs
  • shawnveltman/laravel-openai – Laravel wrapper for OpenAI
  • vizra-ai/vizra-adk – Laravel AI Agent Development Kit for building autonomous agents with tools, persistent memory, workflows, streaming, evaluations, tracing, and Prism-powered multi-model support
  • rahasistiyakofficial/laravel-ai-integration – This is a comprehensive, enterprise-ready package that provides seamless integration with multiple AI providers through a unified, elegant API

Data & DTO tools

  • jeremysalmon/LaravelLLMContext – Laravel package for managing and applying contextual data in LLM interactions
  • 🌟 prism-php/prism – GitHub stars Unified Laravel-native interface for working with LLMs (OpenAI, Anthropic, Gemini, Ollama, etc.), supporting text generation, structured outputs, tools/function calling, and multi-step AI workflows
  • spatie/laravel-data – Typed DTOs for API & AI responses

Localization & Translation

  • Capevace/ai-translations-for-laravel – Laravel package for automatically translating language files with LLMs, detecting missing translations, updating existing locales, validating translation files, and refining translations interactively
  • jayeshmepani/laravel-gemini-translator – Laravel Gemini AI Translation Extractor scans your Laravel project for translation keys, uses Google Gemini AI for translations, and generates language files automatically β€” streamlining and accelerating your localization workflow

Monitoring / Cost Control

  • πŸ§ͺ subhashladumor1/laravel-ai-guard – Laravel package for tracking LLM token usage, estimating AI costs, enforcing per-user or per-tenant budgets, and preventing unexpected AI billing spikes

MCP / Tooling

  • RedberryProducts/mcp-client-laravel – Laravel-native MCP client for connecting to Model Context Protocol servers via HTTP or STDIO, retrieving tools and resources, and integrating external agent capabilities into Laravel apps

Prompt Management

  • πŸ§ͺ prismaticoder/laravel-prompt-manager – Laravel package for managing, versioning, and testing AI prompts for LLM-powered applications
  • πŸ§ͺ SabatinoMasala/laravel-llm-prompt – Lightweight Laravel helper for defining, templating, and composing LLM prompts using PHP classes with variable interpolation and dynamic prompt building

Search & vector search


Symfony & Framework Integrations

  • openai-php/symfony – OpenAI PHP for Symfony integration
  • 🌟 symfony/ai – GitHub stars – Symfony AI: built-in AI components and bundles for Symfony apps
  • soleinjast/symfony-markdown-response-bundle – Symfony bundle that automatically serves Markdown versions of HTML responses to clients
  • πŸ§ͺ symfony/ai-agent – Symfony AI Agent component for building agentic applications that interact with users, execute tasks, and manage workflows
  • πŸ§ͺ symfony/ai-bundle – Symfony integration bundle that brings together Symfony AI components for agents, chat, platforms, stores, RAG, tools, and configuration
  • πŸ§ͺ symfony/ai-platform – Experimental Symfony AI Platform component providing a unified abstraction for interacting with AI models, providers, messages, embeddings, speech, and provider-specific bridge packages
  • symfony/ai-store – Symfony AI component providing a vector store abstraction for semantic search and RAG workflows
  • symfony/mcp-bundle – Symfony bundle for exposing MCP tools, prompts, and resources over HTTP or STDIO using the official MCP SDK

WordPress Integrations

  • WordPress/php-ai-client – Provider-agnostic PHP AI SDK offering a unified API for interacting with multiple LLM providers (OpenAI, Anthropic, Gemini, etc.), supporting text, image, speech, streaming, and multimodal operations

Resources

General

Courses & Tutorials

  • Fun With OpenAI and Laravel – Laracasts series showing how to integrate OpenAI into Laravel apps
  • Laravel Cloud Skills – Interactive learning platform for building and deploying Laravel applications, including modern AI and cloud workflows

ML / AI Platforms

  • ONNX Runtime – Cross-platform, high performance ML inferencing and training accelerator
  • tensorflow/tfjs – JavaScript machine learning platform for training and running models in the browser or Node.js (TensorFlow.js)

Learning Resources


Support this project

If this project helps you, you can support development here:

πŸ’– Sponsor me on GitHub


License

This list is licensed under the MIT License – see LICENSE for details.

Contributing

Contributions are welcome!
Please see CONTRIBUTING.md for details, including criteria for adding new projects (maintenance, documentation, tests, etc).

↑ Back to top

About

The most comprehensive curated list of Machine Learning, Artificial Intelligence, NLP, LLM, and Data Science libraries for PHP

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors

Languages