I have a ZF2 model under a module and I want to call functions in this model from a plain PHP file. This file is located outside of the project folder.
Is there any way?
Related
I have a custom PHP MVC project with the following structure:
app
controller
model
view
core
public
I want to integrate some libraries like mPDF and PHPMailer. My question is where to place the files?
Should I add the files to core directory or use composer with vendor directory to integrate these files?
In case of composer method how to call one of the libraries?
In my project, I can just create an instance of a class like that $user = new \app\controller\User()
In this case to create instance from a library I have to include the autoload file first?
use composer vendor repository, and namespaces of libs in your controllers, include them by use ...;, and yes, you need to use autoload
I am using an third party plugin to enable payment function in my laravel project. But third party only support php. Even they have provided some sample project to show how it worked in php but I have to put those files which includes functions in somewhere in my laravel project and also give them a namespace in the beginning of the file. After I define namespace for phpqrcode.php file, QRcode class still couldn't been found.
Here is the the url where system will need to access QRcode class.
I have put external php in libraries folder:
Here is the file which contains QRcode class and other classes.
Where are the "out-of-the-box" Authentication Controllers and Models for Laravel 5.2.45? I've searched thoroughly and I keep seeing it's in app/http/auth but only HomeController and a minimal Controller.php is there.
Also, It's a fresh install with only minimal edits such as new files to views and assets such as css and js. I used "php artisan make:auth" and the output only stated the new view files.
I'm learning Laravel to replace Codeigniter and this is a stump I've stumbled upon.
The model files are stored directly inside the app directory.
The controller files are stored inside app/Http/Controllers directory. Auth Controller is inside app/Http/Controllers/Auth.
By the way in the mentioned version of laravel no HomeController file is generated by laravel.
I'm a developer who is just migrating from CodeIgniter to Laravel. In CI I had library folder where I could put non database functions, for example email verification etc. In Laravel I couldn't find something like that ? Where can I put such libraries in Laravel 4?
If it is single PHP file containing different functions then you can create a Model class in your Model folder. But this Class will not extend Eloquent. It is a simple class. For example I have a class as General.php containing static methods of general functionality. As Model is autoloaded so I don't need to worry about including file. It is automatically included.
But if it is a directory containing different PHP files or PHP classes then you can create a directory in your app directory and add the path of that directory in providers array in app.php in config directory. You can also create an aliases of your library by putting entry in aliases under providers in app.php.
Create a library (just a folder), namespace it, and set it in config as a provider.
Then you can call it like
new \Foo\Class()
I am developing a portal and using codeigniter with HMVC extension. I have an "admin" module and a "yellowpages" module. Both these modules have a common model eg: "Category_model", and I use it to list down the categories both in the frontend(yellowpages) and backend(admin) module.
So my question is, can I place the model in the application/models directory and have it accessed by both the modules, or do I have to copy the model and place each copy inside /modules/admin/models and /modules/yellowpages/models
Resources may be cross loaded between
modules. ie:
$this->load->model(‘module/model’);
More info here and here