Make an object-oriented Frontend for pfSense



  • Hi guys.
    I have 2 questions about pfSense front end.
    I was wondering if we can make the pfSense front end (PHP side) object-oriented. Is it possible? What's your opinion?
    I have been read some of the front end code and I guess its possible to change the code architecture to OOP. But I am not sure.
    The second question is about /etc/inc/ folder. Is there any technical reason to place the inc files there? Why front end files separated this way?

    Thank you!


  • Rebel Alliance Developer Netgate

    It could, but if someone is putting that kind of effort into rewriting the UI, why stay with PHP?

    Not everything fits the MVC style either, and some things can be made much more complex in the process than they need to be. Frameworks come and go and deprecate things right and left as they progress, so keeping something like that updated can also lead to increased ongoing maintenance.

    The reasons for using /etc/inc/ are purely historical. They should probably be in a place that respects hier(7) better, but there has not been a large motivation to move them over time.

    tl;dr: Can it be done? Yes. Should it be done? Ehhh.



  • Thank you for your attention jimp.

    Actually I have been think about rewriting UI in python, too! But what about extensions? How do I port pfSense PHP extensions into python?
    I don't want to use any framework, and I don't think MVC will make the code style better. I am focusing on OOP aspects, for code clearance. I want the code being clear, rather than using frameworks or MVC arch.


  • Rebel Alliance Developer Netgate

    @msdisatis said in Make a PHP MVC Frontend for pfSense:

    How do I port pfSense PHP extensions into python

    Depends on what you mean by extensions. If you mean the PHP modules, you wouldn't. You'd find equivalent python libraries. If you mean the pfSense PHP module, that would have to be rewritten in something compatible with Python. If you mean packages, then that would be like rewriting any other part in another language.