yield and Generator of php and its application
yield and Generator of php and its application
Reference resources
When viewing the laravel source code, you can see the following code
vendor\laravel\framework\src\Illuminate\Container\Container.php
public function tagged($tag)
{
if (! isset($this->tags[$tag])) {
return []; ...
Added by nomanoma on Sun, 19 Jan 2020 10:04:29 +0200
Laravel Composer automatic loading mechanism
outline
PHP autoloading function 1.1 Origin of PHP autoloading function 1.2 PHP autoload function u autoload() Problems with 1.3 u autoload() Function 1.4 SPL Autoload
PSR Specification
The automatic loading process of comoposer
composer source analysis 4.1 Startup 4.2 Composer autoload file
1, PHP autoloading function
1.1 Origin o ...
Added by Dolemite50 on Sat, 14 Dec 2019 10:54:58 +0200
Laravel user authorization Gate and Policy
Main points:
Laravel has two main ways to implement user authorization: gates and policies.
Gates accepts an instance of the currently logged in user as the first parameter. And receive optional parameters, such as the relevant Eloquent model.
Using command to generate policy PHP artican make: policy postpolicy -- model = post
The ...
Added by mithril on Sat, 07 Dec 2019 16:04:08 +0200
[PHP advanced features] ArrayAccess (array access) interface
php provides six commonly used predefined interfaces to implement certain specific capabilities. The most commonly used one is ArrayAccess, which is used in popular frameworks like Laravel.
What is ArrayAccess
As stated in the official documentation, it "provides an interface to the ability to access objects like arrays.".
It provides ...
Added by cheechm on Fri, 06 Dec 2019 13:55:26 +0200
Self developed composer package of lumen
Take my zero / lumen elastic search package as an example
Note that this plug-in uses the lumen framework
1. Installation dependency
composer require zzq/lumen-elasticsearch
2. Create the elasticsearch.php configuration file with the following contents:
<?php
return [
/**
* You can specify one of several different connections whe ...
Added by ThaSpY on Wed, 13 Nov 2019 16:24:15 +0200
PHP Framework websocket Active Message Push
Laravel combines swoole to implement a function that actively triggers message pushing, which allows you to send custom messages to all members of the template message, instead of sending messages through the client, and listens to the messages sent in the message on the service side for business logic.
Active Message Push ImplementationNormall ...
Added by neptun on Tue, 12 Nov 2019 05:17:24 +0200
PHP Laravel queue tips: Fail, Retry or Delay
When you create a queue job, listener, or subscriber to push to the queue, you may begin to think that once dispatched, it's up to you, the queue worker, to decide what to do with your logic.
Um... It's not that you can't interact with queue workers from within a job, but usually, even if you do, it's unnecessary.
This magical operation is due ...
Added by winstond on Sun, 10 Nov 2019 15:49:58 +0200
Using MongoDB in Laravel
MongoDB utility scenarios
Product user access log, click buried statistical information
Business System Environment Parameter Configuration Information
Business system runtime logs, such as laravel.log, nginx.log
Install MongoDB PHP Driver on macoOS using Homebrew
In macOS, the MongoDB extension has been removed from the Homebrew repository ...
Added by bigfatpig on Sun, 10 Nov 2019 07:08:02 +0200
PHP+RabbitMQ complete code for message queuing
Why RabbitMq instead of ActiveMq or RocketMq?First of all, from a business point of view, I do not require 100% acceptance rate of messages, and I need to develop in combination with php. RabbitMq has a lower latency (subtle level) than RocketMq. As for ActiveMq, it seems that there are many problems. RabbitMq has good support for various langu ...
Added by Liquid Fire on Sun, 03 Nov 2019 13:38:00 +0200
Attendance Application-Human Resource System
Project address Bee
introduce
Bee is a attendance application in human resources system. Its main function is to apply for leave forms. Bee has high performance and extensibility, including front-end separation, plug-in rule validation (verifier), data filtering (decorator), message queue, etc. The back-end adds Services, Repositories layer to ...
Added by mattachoo on Thu, 03 Oct 2019 04:52:37 +0300