Create Multiple Websites with One Shared Library by Zend Framework 2 - zend-framework2

What do I have to do if I want to use one library for many sites using Zend Framework 2? For example I want to have /var/www/zf2-lib and /var/www/site-1, /var/www/site-1 etc.

Add the library to your environments’ include_paths.

You can add the path to yo9ur ZF2 installation to the include_path inside your PHP config:
http://www.php.net/manual/en/ini.core.php#ini.include-path
example, change the path to the location of your shared ZF2 library below:
php.ini
include_path=".:/usr/share/pear;/usr/local/include/ZF2/library/Zend"

Related

Unable to inject the custom JavaScript in .Net Core 2.2 in swagger

I have written a JavaScript which I would like to inject in swagger with .Net Core 2.2. I would like to highlight that wwwroot folder wasn't created by default when I created web project (empty project option) with .Net Core 2.2. I then created wwwroot folder manually and added my JavaScript file inside that. When I am launching swagger, I am getting an error that file couldn't be loaded. I tried to create a folder "swagger" inside wwwroot and place a file there but that too didn't work.
Here is my sample code:
SwaggerUIOptions uiConfig;
uiConfig.InjectJavascript("mycustomfile.js");
Also I would like to highlight what I am trying to achieve here. I got a drop-down in my header for a database provided i.e. Oracle/MSSQL etc. Now based on the selection, I want to change the value of another header i.e. connection string. I have written a JavaScript for this purpose but let me know if that can be achieved in some other and simplistic way as well with .Net Core along withSwashbuckle.
The issue got resolved after using app.UseStaticFiles(); in Configure() method.

Zend framework 2 create simple program with example

I am in new for zend framework 2.
I want simple program for eg 5 values give input add and view the output.
Index.html and indexcontroller.php both file one small example give me.
You can read documentation and create simple application
http://framework.zend.com/manual/current/en/user-guide/overview.html
Or you can get skeleton application
http://framework.zend.com/downloads/skeleton-app

Zend 2 Skeleton. Customize Application module or create own module?

I downloaded the Zend 2 Skeleton Application which comes with the module "Application". This module is the central point of the "Framework".
Now I want to add some routes/pages like "terms", "contact" etc. That brings me to the essential question:
Is it best practise to customize the "Application" module or am I supposed to create my own module? Especially if I want to add some static pages? If I'm gonna customize the Application module I can't update the Framework via composer anymore, I guess.
Thanks for everyone's help.
It depends. If you wanna edit this "static pages" via wysiwyg make separate module for pages (CMS ?)
If you will have pure static pages just add new controllers to Application.
Current trend is to make API in backend and use some frontend framework for front (so front-end will be responsible for load proper views)

zend framework 2 out of the box modular system

I want to make a modular CMS in Zend Framework 2 . Like News module , Gallery module and etc...
How to make independent module in zf2 ? My biggest challenge in this case is configuring other modules like Zfcadmin and BjyAuthorize modules.
How Can I set all configurations in my own module ? Is it possible ?
You can config other modules in your module. For example you can add child route of ZfcAdmin in your news module . There is no obligation to configure each module in its module.config.php file. Remember modules are just namespaces
You should definitely have a look at ensemble if you want to develop your own CMS. Ensemble is built on top of ZfcAdmin so you can hook into both if you want to.
Disclaimer: I am the author of both Ensemble and ZfcAdmin
With regard to the configuration of ZfcAdmin, you should definitely start with the documentation. It's provided in the repository of ZfcAdmin. There is also a single page document about BjyAuthorize how to configure the module.
If you are not familiar with ZF2 and modules of ZF2 in general, I suggest to follow the user guide first.

Deploying ZF2 application to a shared hosting

I have a domain name as addon on. It is called www.myapp.cöm and because it ais an addon domain it is located at çtp://myrealdomain.cöm/myapp/
How I'll put those ZF2 files? I don't want to put all of them under çtp://myrealdomain.cöm/ folder.
you had to place all you application public files in the myapp folder and can place all other files (modules) on different location and link it with the exact path in configuration file declaration for modules).
for ZEND library if your server configuration allow variable in .htaccess you can set ZF2=path to zend library and you can place the lib files any ware accessible in your host
Hi I had posted an answer for setting up zf2 application in shared hosting, hope this may help follow the link below
ZF2 in shared hosting environment

Resources