{"id":50525585,"url":"https://github.com/b7s/neuraphp","last_synced_at":"2026-06-03T07:31:36.424Z","repository":{"id":360552817,"uuid":"1250666404","full_name":"b7s/neuraphp","owner":"b7s","description":"Local text embeddings via PHP FFI. No Python, no API calls, no external services at runtime.","archived":false,"fork":false,"pushed_at":"2026-05-26T22:31:00.000Z","size":67,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-26T23:24:12.525Z","etag":null,"topics":["ai","embedded","embeddings","laravel","local","php","vector"],"latest_commit_sha":null,"homepage":"https://brunots.dev/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/b7s.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-05-26T21:21:05.000Z","updated_at":"2026-05-26T22:31:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/b7s/neuraphp","commit_stats":null,"previous_names":["b7s/neuraphp"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/b7s/neuraphp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b7s%2Fneuraphp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b7s%2Fneuraphp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b7s%2Fneuraphp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b7s%2Fneuraphp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/b7s","download_url":"https://codeload.github.com/b7s/neuraphp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b7s%2Fneuraphp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33854008,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-03T02:00:06.370Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","embedded","embeddings","laravel","local","php","vector"],"created_at":"2026-06-03T07:31:35.772Z","updated_at":"2026-06-03T07:31:36.419Z","avatar_url":"https://github.com/b7s.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n   \u003cimg src=\"docs/logo.png\" width=\"222\" alt=\"NeuraPHP\"\u003e\n\n   # NeuraPHP\n\nNeuraPHP brings local AI embeddings to PHP—no APIs, no subscriptions, no external services. Run fast, private, personalized text embeddings directly on your machine, saving money while keeping full control of your data. Simple to install, effortless to use, and built for real‑world PHP apps.\n\n[![PHP 8.3+](https://img.shields.io/badge/PHP-8.3%2B-777BB4)](https://php.net)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n\u003c/div\u003e\n\n## Features\n\n- **Local embeddings** — No API calls, no network latency, no data leaving your server\n- **PHP FFI** — Direct memory access to a **C library**, no separate process\n- **Fluent API** — `Neuraphp::make()-\u003emodel(ModelReference::fromEnum(Model::AllMiniLML12V2))-\u003eembed('text')`\n- **Multiple models** — AllMiniLM-L6-v2, AllMiniLM-L12-v2, Paraphrase, BGE, E5, multilingual; or any BERT-compatible HuggingFace model\n- **Quantization** — F32, F16, Q4_0, Q4_1 for speed/quality tradeoffs\n- **Vector math** — Cosine similarity, dot product, Euclidean distance, L2 normalization\n- **CLI tools** — `neuraphp install` for auto-setup, `neuraphp doctor` for diagnostics, `neuraphp info` for configuration\n- **Laravel integration** — Optional service provider and facade\n- **Framework-agnostic** — Works with any PHP 8.3+ project\n\n**Docs:** [Manual Installation](docs/advanced-guide.md#manual-installation) · [Quick Start](docs/advanced-guide.md#quick-start) · [API Reference](docs/advanced-guide.md#api-reference) · [Supported Models](docs/advanced-guide.md#supported-models) · [Configuration](docs/advanced-guide.md#configuration) · [Laravel Integration](docs/advanced-guide.md#laravel-integration) · [CLI Reference](docs/advanced-guide.md#cli-commands-reference)\n\n### Add to your project:\n```bash\ncomposer require b7s/neuraphp\n```\n\n## Quick Start\n\n```php\nuse B7s\\Neuraphp\\Neuraphp;\nuse B7s\\Neuraphp\\ModelReference;\nuse B7s\\Neuraphp\\Enums\\Model;\n\n// Embed text (uses default model: AllMiniLML6V2)\n$result = Neuraphp::make()-\u003eembed('Hello world');\necho $result-\u003edimension();  // 384\n\n// Use a specific model\n$result = Neuraphp::make()\n    -\u003emodel(Model::BgeSmallENV15)\n    -\u003eembed('Hello world');\n\n// Compare two texts\n$similarity = Neuraphp::make()\n    -\u003ecosineSimilarity('The cat sat on the mat', 'A feline rested on the rug');\n```\n\n\u003e For more examples, custom models, batch embedding, and the full API — see the [Advanced Guide](docs/advanced-guide.md#quick-start)\n\n## ⚠️ Prerequisites: embedding.cpp Library \u0026 Model\n\n\u003e **Neuraphp requires `libbert_shared.so` (compiled from embedding.cpp) and a GGUF model file to function.**\n\n**Minimum versions required to compile the library:**\n\n| Tool | Min Version | Install |\n|------|-------------|---------|\n| Git | 2.0+ | [git-scm.com](https://git-scm.com) |\n| CMake | 3.18+ | [cmake.org](https://cmake.org/install/) |\n| GNU Make | 3.81+ | `sudo apt install build-essential` / `xcode-select --install` |\n| C++ compiler (g++/clang++) | GCC 10+ / Clang 10+ (C++20) | `sudo apt install g++` / `xcode-select --install` |\n| Rust (cargo) | 1.75+ | [rustup.rs](https://www.rust-lang.org/tools/install) |\n| Git LFS | 2.0+ | `sudo apt install git-lfs` / `brew install git-lfs` |\n| Python | 3.8+ | (model conversion only) |\n\nThere are two ways to set these up:\n\n---\n\n### Option A: Automatic Installation (Recommended)\n\nRun the installation command - it clones, compiles, and downloads everything for you:\n\n```bash\n./vendor/bin/neuraphp install\n```\n\n\u003e You need to run this command just once for each model you want to use. If you don't change the model, you don't need to re-run it.\n\nThis will:\n1. **Check prerequisites** (git, cmake, make, C++ compiler, Rust, git-lfs)\n2. **Clone embedding.cpp** into a temp directory and compile `libbert_shared.so`\n3. **Download the default model** (all-MiniLM-L6-v2) from HuggingFace\n4. **Convert the model** to GGUF format (requires Python 3.8+, torch, transformers)\n5. **Copy only final artifacts** to `bin/neuraphp-data/` in your project root\n   - **Clean up** temp files and create `bin/neuraphp-data/.gitignore` so artifacts are never committed\n\n**Options:**\n\n```bash\n# Install a specific model (short name or full HuggingFace ID)\n./vendor/bin/neuraphp install --model=bge-small-en-v1.5 --quantization=f16\n\n# Install a custom BERT-compatible model\n./vendor/bin/neuraphp install --model=custom-org/my-bert-model\n\n# Skip library compilation (if already installed)\n./vendor/bin/neuraphp install --skip-library\n\n# Skip model download (if already downloaded)\n./vendor/bin/neuraphp install --skip-model\n\n# Force re-download/re-compile\n./vendor/bin/neuraphp install --force\n\n# Keep model source files after conversion\n./vendor/bin/neuraphp install --keep-source\n\n# Use a specific Python for model conversion\n./vendor/bin/neuraphp install --python-path=~/myenv/bin/python3\n\n# Check if Neuraphp is properly configured\n./vendor/bin/neuraphp doctor\n\n# Show model and configuration info\n./vendor/bin/neuraphp info\n\n# With options\n./vendor/bin/neuraphp doctor --library-path=/custom/libbert_shared.so\n./vendor/bin/neuraphp info --model=all-MiniLM-L6-v2 --quantization=q4_0\n```\n\n## Testing\n\n```bash\n# Run all tests\ncomposer test\n\n# Run with coverage\ncomposer test:coverage\n\n# Code style\ncomposer pint\n\n# Static analysis\ncomposer stan\n\n# Quality gate\ncomposer catraca\n\n# Run all checks\ncomposer check\n```\n\n## License\n\nMIT\n\n---\n\nLogo by: \n\u003ca href=\"https://www.flaticon.com/free-icons/neuro\" title=\"neuro icons\"\u003eNeuro icons created by Uniconlabs - Flaticon\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb7s%2Fneuraphp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fb7s%2Fneuraphp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb7s%2Fneuraphp/lists"}