How to include () functions in a class in PHP

Possible duplicate:
Is it possible to include code in a PHP class?

Hello,

I have some third part php files that I would like to include as classes in my application. The problem is that these files continue to change, and they are not OOP, but just a bunch of functions. In order for them to update and work within my framework, I have to use them in the class, so I would like to include the file and access it through → operator:

Example:

class Vendor {
    include("../vendor/functions.php");
}

and then:

$vendor = new Vendor();
$vendor->foorbar();

Any ideas?

+3
source share
2 answers

I think the best way is to modify (automate) the functional files to include

namespace VendorName;

, , . :

VendorName\FunctionName($arguments);
+3

, , , . , Subversion " ". , , . :

  • .
  • .
  • , .
  • , .
0

Source: https://habr.com/ru/post/1771939/


All Articles