Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yii: requiring a .php file

Tags:

php

yii

I develop a project with Yii.

I need to require a plain .php file (not component, not a class, just a regular sequence of PHP functions definitions). What is the correct way to do this under Yii framework? Should I use plain require_once()?

require_once(Yii::app()->basePath . '/extensions/my-php-file.php');

Right?

like image 414
porton Avatar asked Jun 24 '13 18:06

porton


People also ask

Is Yii a PHP framework?

Yes, it is! Yii is a fast, secure, and efficient PHP framework.

What does Yii Framework mean in PHP?

Yii is a high-performance, component-based PHP framework for developing large-scale Web applications rapidly. It enables maximum reusability in Web programming and can significantly accelerate your Web application development process. The name Yii (pronounced Yee or [ji:] ) is an acroynym for "Yes It Is!".

Is Yii2 compatible with PHP 8?

This release makes Yii 2 compatible with PHP 8.1, fixes a number of bugs and adds some enhancements.


1 Answers

Yes, that's correct.

Example:

require_once Yii::app()->basePath . '/extensions/PearMail/Mail-1.2.0/Mail.php';
like image 149
Amal Murali Avatar answered Oct 14 '22 10:10

Amal Murali