Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Modules
  • Do I need Modules? Is modules better than packages? How to use modules? How to config modules? How does the code looks in the module? How is organised the code in the module like one class or more than one classs? Give me example of using modules with Controller for example. Is there a class or classes in the module? How is the namespace connected with the module? Give me practical, not a theoretical example. Give me simple code for using module with Controller for example. How to use modules like a libraries?
  • Modules extend or make the application modules (the frontend), Packages extend the framework (the backend). In a truly modular system, you need both.

    I have for example a package for pdf generation (https://github.com/WanWizard/fuel-pdf), that I simply add to every application in which I need to generate PDF documents. You create the package once, and re-use it in every application you write.

    The same is true for modules. Our apps all have an admin module, which contains all controllers and models for user, group and permission management. It also deals with login, logout, registration of new accounts, etc. Written once, plugged into every application.

    The way modules work is documented. The content of a module is exactly the same as your app folder.

    Spend some time going through the documentation. Modules are documented here: http://fuelphp.com/docs/general/modules.html, and that page answers all your questions.
  • I don`t understand anything you said. And some parts of the documentation is puzzle and other has errors!!!
  • If this is too difficult for you, I don't know where to start.

    The Modules page in the documentation describes
    - what (in the context of FuelPHP) a module is
    - how you configure the framework to use modules
    - the module namespace
    - the module folder structure

    I have a feeling you're completely new at PHP, in which case starting with an OO framework might not be the best choice. FuelPHP is not an absolute beginners framework, it requires that you know your object oriented PHP.

    This is a bit like diving into the deep end of the pool without knowing how to swim.
  • What is in module documentation the term "the code base" meaning?
  • Harro Verton may be you are right a little but I have knowledge in html, css, javascript, php and C++. I don't claim to know this programming languages, I claim to play or use (with) them.
  • "This is a bit like diving into the deep end of the pool without knowing how to swim." 
    I think you are wrong because when you dived deep, you are called adventurer. Adventurers have advantages and disadvantages. Philosophy has only one rule that everything is like a coin with two sides but there are people who see more, they are called adventurers. If you don't think, your coin will have two sides - heads and tails. But if you are blind, you will see better like a wise man in Ancient China and ... Coin has many sides, you must turn it vertically or .................................... to see them. I counted 6. How many will you count? This is rhetorical question. I sorry if I offended you someгду but this is the truth which is equal to untruly by other point of view.
  • That is not a problem, everyone needs to start at the beginning, we did too.

    As said in another thread, we do not cater to the absolute beginner, I think before you start with a PHP framework, you need to know your way around PHP itself.Classes, namespaces, object oriented design should not be strange to to. If you don't have this background, I can imagine it is quite difficult to understand the concepts.

    The examples that are in the documentation are working examples, so you can just use them and see what they do. This is the way you learn a language, not by reading a book, watching a tutorial or reading forum posts.

    It's a bit like painting, you can read about it, talk to people about it, but as long as you don't pick up the brush and paint, you will never produce a decent painting.

    You refer to the entire collection of programs of an application as the "code-base". Modules, if designed correctly, are not coupled to anything outside the module. If you design it like that, you can re-use your modules in multiple applications. And that means that as your module collection grows, you get quicker and quicker is producing new applications.
  • Thank you. 
  • What is the purpose of this:

    Cross modules file loading

    When can I use this and for what?

    Whether it's a config file or a view file cross module file loading must have the module prefixed to the filename:
    // Cross load a config
    \Config::load('othermodule::myconfig');

    // Cross load a view
    \View::forge('othermodule::subdir/view');
    Run a task from module:
    $ php oil refine :::
  • If you don't know where to use it, why would you want to?

    You should absolutely NOT want to do this, it creates tight coupling between your modules, and that is simply not done. The correct way for modules to interact is through an HMVC request.

    This is a typical example of a community request. The functionality is there because users wanted it, not because we wanted it.
  • I have many questions but I don't have the time to ask. I will do it tomorrow.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion