1 / 2

What is an Event in Yii2

You can use events to insert custom code into existing code at specific periods during execution. You can connect custom code to an event so that it is automatically performed when the event is triggered.

XcelTec1
Download Presentation

What is an Event in Yii2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. What is an Event in Yii2? Because PHP doesn't have built-in events like JavaScript does, event programming isn't necessarily a developer's strong suit. The only real event in PHP is responding to a request from a PHP script (through a direct link or a form submission). That event triggers the execution of the PHP code in that script. On the other hand, as long as the browser window is active, you may use JavaScript to have your code keep an eye out for and react to a number of events (such the submission of a form or the movement of the pointer, for example). Thanks to the component class, Yii gives PHP-based websites more event functionality. The declaration "when this event occurs with this thing, run this function" marks the start of event handling in any language. Yii allows you to create your own events, but models have their own set of preset events that need to be watched out for before they are stored, after they are saved, before they are verified, and so on (the available events will depend upon the model type). Yes, each of the aforementioned methods relates to a specific event that Yii will monitor using your models. You should utilise events when something that occurs in one instance of model A should also cause a response in another instance of model B. You'll observe instances of this over time.

  2. Nevertheless, keeping an eye out for events can be a helpful way to add a few more stages to an existing model. Yii2 events: can make a predefined piece of code run at a particular time. Events can be used to construct business processes in addition to decoupling code. Today's software has a tonne of events. As an illustration, you might publish a Weibo that will prompt folks who follow you to view your fresh content as a result of a specific circumstance. Conclusion Yii2 has extensive event support. An event may be started to carry out a number of tasks after an operation is finished. For your projects, XcelTec provides the best Yii2 service. Visit to explore more on What is an Event in Yii2? Get in touch with us for more! Contact us on:- +91 987 979 9459 | +1 919 400 9200 Email us at:- sales@xceltec.com

More Related