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.
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'
This is also an artificial The smart project is an advanced PHP neural network library that can use PHP to implement a powerful machinelearningproject.
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.
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.
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 // )
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
Start in daemon mode
php start.php start -d
2) Stop
php start.php stop
3) Restart
php start.php restart
4) Smooth restart
php start.php reload
5) Check status
php start.php status
什么是数据库迁移工具呢,你可以先这样理解,就是一个数据库导入工具。
一般的如果我们需要导入数据库,需要先去之前的数据库导出sql文件,然后到另一个站点上导入sql文件。似乎这是天经地义的,没什么更好的方法,再好一点也就是做一个一键安装脚本。
其实有更好的方案,就是用数据库迁移工具phinx,在安装数据库时,不需要导出和导入sql文件,而是直接使用phinx提供的方法,设计好表结构,然后通过phinx的命令导入。
这样有很多好处:
更优雅的安装方式,与系统代码一起管理,无需导出sql文件
支持数据库升级降级,可以跟随系统升级,自动对比数据表变化,不用担心数据丢失
支持多款数据库,在phinx设计的表结构可以直接安装到Mysql、PostgreSQL、SQLite、SQL Server
phinx绝对是现代的程序安装解决方案,你值得投入精力去使用它。
它的基本的用法像这样:
table('user_logins'); $table->addColumn('user_id', 'integer') ->addColumn('created', 'datetime') ->create(); } }
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); .....
相比介绍的前几个项目,PHP-CPP并不是一个PHP的扩展或库,它是一个C++的框架,用来开发PHP扩展。
众所周知,PHP的扩展开发很困难,你一搜PHP的扩展开发,所有人都告诉你那可怕的Zend API,就像遇见了伏地魔一样,人们不敢提起它。
PHP-CPP解决了这样的混乱的Zend API的问题,实际上他解决了很多问题,使用他开发PHP扩展,写起C++代码来就像写PHP一样,毕竟PHP的语法也参考了C风格。
就像下面这样,简单几行就完成了一个PHP扩展。
#include#include 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"); return extension; } }
PHP-CPP还提供了丰富的文档和注释,手把手教你如何注册函数、调用函数、匿名函数、类和对象、解析和构造、魔术方法等。
很多人总是忽视这个PHP-FPM,甚至嫌弃他。
实际上,PHP-FPM是一个大杀器,
稳定的运行
丰富的扩展
性能进阶方案
在Web中仍然闪闪发光。
原文地址:https://phpreturn.com/index/a624ac38895749.html
原文平台:phpreturn(PHP武器库)