Jump to content

How to "share" my classes?


ZeratulsDomain3

Recommended Posts

At work I wrote many classes/function that are hundreds of lines of code. This code rarely changes, but it does happen. Some of this code is also used in all 4 of the sites.

 

Problem right now is I have "4 sites" with duplicate code on them (copy/pasted). All on a single server running IIS. How can set this up so all 4 sites "share" the same PHP code?

 

My temporary "dirty" fix to this has been to: Setup a 5th site in IIS. Setup a firewall rule to block any access to it, then rename all my PHP files to ".txt" files then simple do "require "somePHPcode.txt" (this way IIS wont "run them" before sending them).

 

This works, but its not very elegant. Got a better method?

Link to comment
https://forums.phpfreaks.com/topic/227749-how-to-share-my-classes/
Share on other sites

What you really want to do, seems like a possible security-flaw to me: fetching external scripts to run on your server...

 

Wouldn't an account with f.e. github not be better? You put all classes together, you can maintain your code very easily and everytime you make some adjustments, you can simply fetch the updates with git...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.