Table of Contents
1. php-ai/php-ml, an advanced PHP machine learning library
2. rindow/rindow-neuralnetworks, an advanced PHP neural network library
3. rubix/ml, an advanced PHP machine learning and deep learning library
4. nlp-tools/nlp-tools, a semi-advanced natural language processing library for beginners
5. workerman/gateway-worker, a distributed long link service framework
6、robmorgan/phinx,一个数据库迁移工具
7、league/flysystem,一个PHP的万能的文件存储操作库
8、PHP-CPP,一个C++的PHP扩展开发框架
9、PHP-FPM,一个强大的稳定的HTTP服务框架
Home headlines 9 killer PHP projects, come and collect them for use!

9 killer PHP projects, come and collect them for use!

May 05, 2022 pm 12:02 PM
php

PHP has been developed for so many years and there are many interesting projects. Let’s get rid of those pesky CRUDs and learn about these fun projects.

1. php-ai/php-ml, an advanced PHP machine learning library

php-ml is a machine learning implementation using PHP The library includes algorithms, neural networks, cross-validation, preprocessing, feature extraction and other commonly used functional solutions in the field of artificial intelligence.

The official also provides numerous cases, such as:

  • Detecting language classification

  • MNIST recognizes handwritten fonts (standard Artificial intelligence introductory project)

  • Spam filtering

  • Article classification

  • Predict the quality of wine

php-ml has a complete documentation and rich blog articles. But this is already the field of artificial intelligence, and your knowledge structure may not be able to be used for a while.

The simple usage is as follows:

require_once __DIR__ . '/vendor/autoload.php';

use Phpml\Classification\KNearestNeighbors;

$samples = [[1, 3], [1, 4], [2, 4], [3, 1], [4, 1], [4, 2]];
$labels = ['a', 'a', 'a', 'b', 'b', 'b'];

$classifier = new KNearestNeighbors();
$classifier->train($samples, $labels);

$classifier->predict([3, 2]);
// return 'b'
Copy after login

2. rindow/rindow-neuralnetworks, an advanced PHP neural network library

This is also an artificial The smart project is an advanced PHP neural network library that can use PHP to implement a powerful machine learning project.

It has the following characteristics:

  • can easily implement DNN, CNN, RNN and Attention machine learning models

  • and Python's Keras is very similar, you can use relevant experience

  • Provides machine vision and natural language processing in machine learning

  • The processing performance is Twice the tensorflow CPU

  • No need for a special operating environment, can run in any computer environment

  • Comes with interesting sample programs

And there are related calculation extensions to improve performance. There is also an extension to the GPU, which can use the computing power of the GPU to further improve performance, but this is still in the testing stage.

9 killer PHP projects, come and collect them for use!

3. rubix/ml, an advanced PHP machine learning and deep learning library

Yes, here is another introduction An artificial intelligence library for PHP.

He has the following characteristics:

  • Very developer-friendly interface method call

  • 40 kinds of supervision or unsupervised learning methods

  • Supports ETL, preprocessing and cross-validation

Compared to the above two, it provides the most Tutorials and sample projects of tutorials and sample projects, the more interesting of which include divorce prediction, DOTA2 winning rate prediction, etc., and a communication channel for the Telegram group is provided.

9 killer PHP projects, come and collect them for use!

4. nlp-tools/nlp-tools, a semi-advanced natural language processing library for beginners

This is a library specifically designed to deal with the field of natural language processing in artificial intelligence. The methods it provides are lower-level than the previous ones, but they are still elegant to use.

It has built-in multiple classification models, clustering methods, word segmenters, data sets, etc., and almost all the tools and data needed for this collection.

Compared with several projects introduced before, it is specially designed to deal with the field of natural language and is very friendly to beginners. It has rich documentation and a complete set of built-in tools and data.

Here is a demonstration of the word segmentation effect:

include('vendor/autoload.php');

use NlpTools\Tokenizers\WhitespaceAndPunctuationTokenizer;

$text = "Please allow me to introduce myself
        I'm a man of wealth and taste";

$tok = new WhitespaceAndPunctuationTokenizer();

print_r($tok->tokenize($text));

// Array
// (
//    [0] => Please
//    [1] => allow
//    [2] => me
//    [3] => to
//    [4] => introduce
//    [5] => myself
//    [6] => I
//    [7] => '
//    [8] => m
//    [9] => a
//    [10] => man
//    [11] => of
//    [12] => wealth
//    [13] => and
//    [14] => taste
// )
Copy after login

GatewayWorker is based on Workerman A project framework developed to quickly develop TCP long-connection applications, such as app push servers, instant IM servers, game servers, Internet of Things, smart homes, etc.

Compared with other such solutions, it provides several incomparable advantages:

  • Built-in process daemon, you can use a simple command line Stable operation, no need to implement background operation or process daemon by yourself

  • Built-in distributed design, can achieve distributed deployment without modifying any code

  • Complete long link operations, including binding UID to connections, binding groups to connections, maintaining SESSION, etc.

  • Provides standard usage of push messages within the system. Provides a client that can send messages to the gateway network at any time

gatewayworker solves almost all pain points in long link development and is very easy to use. It should be noted that it is a framework designed for long connections. If it is a short connection (UDP), other solutions are required.

The startup method is as follows. No more operations are required to robustly complete the process daemon and restart smoothly.

1) Start

  • Start in debug mode

php start.php start
Copy after login
  • Start in daemon mode

php start.php start -d
Copy after login

2) Stop

php start.php stop
Copy after login

3) Restart

php start.php restart
Copy after login

4) Smooth restart

php start.php reload
Copy after login

5) Check status

php start.php status
Copy after login

6、robmorgan/phinx,一个数据库迁移工具

什么是数据库迁移工具呢,你可以先这样理解,就是一个数据库导入工具。

一般的如果我们需要导入数据库,需要先去之前的数据库导出sql文件,然后到另一个站点上导入sql文件。似乎这是天经地义的,没什么更好的方法,再好一点也就是做一个一键安装脚本。

其实有更好的方案,就是用数据库迁移工具phinx,在安装数据库时,不需要导出和导入sql文件,而是直接使用phinx提供的方法,设计好表结构,然后通过phinx的命令导入。

这样有很多好处:

  • 更优雅的安装方式,与系统代码一起管理,无需导出sql文件

  • 支持数据库升级降级,可以跟随系统升级,自动对比数据表变化,不用担心数据丢失

  • 支持多款数据库,在phinx设计的表结构可以直接安装到Mysql、PostgreSQL、SQLite、SQL Server

phinx绝对是现代的程序安装解决方案,你值得投入精力去使用它。

它的基本的用法像这样:

<?php

use Phinx\Migration\AbstractMigration;

class CreateUserLoginsTable extends AbstractMigration
{
    public function change()
    {
        // 创建表结构
        $table = $this->table(&#39;user_logins&#39;);
        $table->addColumn(&#39;user_id&#39;, &#39;integer&#39;)
              ->addColumn(&#39;created&#39;, &#39;datetime&#39;)
              ->create();
    }
}
Copy after login

7、league/flysystem,一个PHP的万能的文件存储操作库

flysystem是一个PHP的文件操作库,比如文件的读取、写入、目录列表等等操作。与众不同的是,他是“万能的”。其实说它是万能的有些夸张了,但是他官方支持了以下系统:

  • 本地存储

  • FTP存储

  • SFTP存储

  • 内存存储

  • 亚马逊云存储

  • 谷歌云存储

  • WebDAV存储

在社区生态中,还支持我们经常接触的一些系统:

  • 阿里云存储

  • 七牛云存储

  • Dropbox存储

  • 腾讯云存储

  • 华为云存储

等等,如果你需要,也可以自定义驱动。

就像下面的代码一样,对文件的操作是通用兼容的,如果需要切换存储系统,换一个驱动就可以了。

// 设置驱动
$adapter = new League\Flysystem\Local\LocalFilesystemAdapter($rootPath);
$filesystem = new League\Flysystem\Filesystem($adapter);

// 操作文件、目录
$filesystem->write($path, $contents);
$filesystem->read($path);
$filesystem->delete($path);
$filesystem->listContents($path, $recursive);
$filesystem->fileExists($path);
$filesystem->has($path);
$filesystem->lastModified($path);
.....
Copy after login

8、PHP-CPP,一个C++的PHP扩展开发框架

相比介绍的前几个项目,PHP-CPP并不是一个PHP的扩展或库,它是一个C++的框架,用来开发PHP扩展。

众所周知,PHP的扩展开发很困难,你一搜PHP的扩展开发,所有人都告诉你那可怕的Zend API,就像遇见了伏地魔一样,人们不敢提起它。

PHP-CPP解决了这样的混乱的Zend API的问题,实际上他解决了很多问题,使用他开发PHP扩展,写起C++代码来就像写PHP一样,毕竟PHP的语法也参考了C风格。

就像下面这样,简单几行就完成了一个PHP扩展。

#include <phpcpp.h>
#include <iostream>

void myFunction()
{
    Php::out << "example output" << std::endl;
}

extern "C" {
    PHPCPP_EXPORT void *get_module() {
        static Php::Extension extension("my_extension", "1.0");
        extension.add<myFunction>("myFunction");
        return extension;
    }
}
Copy after login

PHP-CPP还提供了丰富的文档和注释,手把手教你如何注册函数、调用函数、匿名函数、类和对象、解析和构造、魔术方法等。

9、PHP-FPM,一个强大的稳定的HTTP服务框架

很多人总是忽视这个PHP-FPM,甚至嫌弃他。

实际上,PHP-FPM是一个大杀器,

  • 稳定的运行

  • 丰富的扩展

  • 性能进阶方案

在Web中仍然闪闪发光。

9 killer PHP projects, come and collect them for use!

原文地址:https://phpreturn.com/index/a624ac38895749.html

原文平台:phpreturn(PHP武器库)

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

7 PHP Functions I Regret I Didn't Know Before 7 PHP Functions I Regret I Didn't Know Before Nov 13, 2024 am 09:42 AM

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

PHP Program to Count Vowels in a String PHP Program to Count Vowels in a String Feb 07, 2025 pm 12:12 PM

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? Apr 03, 2025 am 12:03 AM

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.