Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9139285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:22:04+00:00 2026-06-17T09:22:04+00:00

Main question is self explanatory, but I’ll give some side examples: I’m having trouble

  • 0

Main question is self explanatory, but I’ll give some side examples:

  • I’m having trouble figuring out databases, though it seems I can work out config with ServiceManager stuff

  • I want to use constants for cookie names, so I can change them easily if there are collisions. Current, I’m calling $config = new \Zend\Config\Config(include $_SERVER['DOCUMENT_ROOT'] . '/../config.php'); every time I want access to my global config.php file. A lot of previous solutions were in Zend 1 (eg Zend_Registry). Is this the right way to do it? It seems a little unwieldy using that over and over.

  • Is there a way to utilize a Module’s configuration file to set module-wide-variables/constants?

  • Unless I’m completely missing it, there’s no application.ini in Zend 2

  • Storing recaptcha public/private keys

  • I’m also using my config file for session-variables (same idea as $_SESSION[CONST_NAME]), which makes it really clumsy with the config file above. Is it better to hardcode the session names? Like:


$container = new Zend\Session\Container('auth');
$container->offsetSet('user', $user);
... // instead of 
$container = new Zend\Zession\Container($config['auth']['containername']);
$container->offsetSet($config['auth']['user'], $user);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:22:04+00:00Added an answer on June 17, 2026 at 9:22 am

    All configuration from each module.config.php or Module.php are put together into a big pot. You can easily access those via $this->getServiceLocator()->get('config')

    When it comes down to constants, they should be placed inside the respective classes. Like

    class UserStorage {
        const SESSIONCONTAINERNAME = 'blubbusersession';
    }
    

    That way you can call \My\User\Model\UserStorage::SESSIONCONTAINERNAME whenever you need this info

    As far as your example is concerned thought, there should be almost no need to var-code your session-container-name because the information from your modules session-data should be made available via your modules Service-Classes. But if you still need it, see aboves example.

    Furthermore i think it may be a good idea for you to check out how zf-commons\ZfcUser does things

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know it's a noob question, but I'm trying to figure out why self.update_count,
first of all, my main question: What are some good troubleshooting techniques when you
My Question is similar to This SO question , but with the main difference
my question is more or less self-explanatory, I am trying to find a standard
Main question is what are the implications of allowing the this keyword to be
My main question is given a feature centroid, how can I draw it in
My main question is : Is there a good practice to serve binary files
I guess my main question is, will this always work as long as I
The title is the main question. The exact scenario (I am 'using namespace std;'):
This was the main question posed by Greg Wilson's bits of evidence presentation. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.