How to use Manifest File for Zend framework routing configuration?

Do you ever stuck while rendering your page using Zend Framework routing ? It’s important to understand how framework renders content for every action. Every framework has its own way to organized pages or action for each module. Zend framework map URL to a particular action using routes configuration. SocialEngine routing based on Zend framework routing which use the manifest file as module routes configuration. In this article, we demonstrate how to use Manifest File for Zend framework routing configuration .

The Manifest file is a text file that lists out all of the application resources that browsers look for in order to determine which files is used to run the application to work. Once a resource is stored in the manifest file, the browser used to call the application request from this file. Manifest.php file resides in the root directory of every application. The manifest file presents essential information about your website. If a file changes, the manifest file needs to be changed as well. If a file is added, it needs to be added to the manifest file.

A very interesting thing about Manifest file is the possibility of creating offline applications through the cache. This pages can be read by the user when he doesn’t have an Internet connection, In today Era, most of the application supporting the offline working of the website or mobile app. So we can use the manifest file to provide offline access to the website or mobile app to the users. It also provides faster page loading of the application because the user doesn’t have to download all the data.

Zend Framework routing using Manifest file

For Zend Framework routing, setting up manifest file configuration, you may need to know how to write manifests. In order to use manifests effectively, you must understand how manifests constructed. This article covers manifests basics, and will show you how to construct manifests that will help you get started with using manifests to manage your server environment. We will show the ways to use manifests to configure with your website.

Naming conventions

The file must be named manifest.php and located in the root directory of the installation package.

Manifest Definitions

The manifest definition tells how module manifest is structured and options available when developing the module. The following section outlines the parameters specified in the $manifest array contained in the manifest file (manifest.php). $manifest array elements provide the Module Loader with descriptive information about the extension.

Example:- We are developing a module manifest file for an application, In below cases we have the manifest file which is used when user module is used and this manifest has depended on core module.

return array(
    'package' => array(
    'type' => 'module',
    'name' => 'user',
    'version' => '4.0.0',
    'path' => 'application/modules/...',
    'description' => 'Members Entry',
    'author' => 'Javed Usmani',
    'dependencies' => array(
     array(
        'type' => 'module',
        'name' => 'core',
        'minVersion' => '4.0.0',
      ),
    ),
  ),
);

 

  •  Manifest array is a root element in manifest file, every manifest entry comes into this array, which contain the descriptive details of the manifest file related to the version, path, title, description etc.
  •  Manifest Package is an array which determines which type of module is being specified. Module loader fetches each parameter information from this package array and make a URL request.
  • Type define the purpose of the manifest file, whether you are working on a module or writing a plugin.
  • Name is used to display the name of the module in the module loader.
  • Version describe the current version of the manifest file. The version is needed when any break occurs in manifest file.
  • The directory path of the manifest file.
  • The purpose of the the manifest file, What this manifest file do.
  • Who are writing this manifest file.
  • You can define an extra check that this manifest file is depend on one or more other module. Dependency header is used to define an dependency.

Note:- If you are using custom route when creating the manifest file, You should also specify the default param that the route define, which is module, controller, action.

'user_signup' => array(
    'route' => '/signup/:action/*',
    'defaults' => array(
    'module' => 'user',
    'controller' => 'signup',
    'action' => 'index'
  )
),

 

Manifest Entry

you can create or use manifest file entry as per different way which is given below:-

1. Use the existing manifest to load the application:-

You can use the existing manifest entry inside in manifest.php file which tells to the application which action/page is to call or how to deploy the application.

'user_signup' => array(
'route' => '/signup/:action/*',
'defaults' => array(
'module' => 'user',
'controller' => 'signup',
'action' => 'index'
)
),

When we install the package or module, Package contains a manifest file. We can use this manifest entry to signup the new user on a website, there is no need to create a new manifest entry.

2. Override existing manifest settings with your custom manifest entry:-

The best thing about the manifest is that it lets you override existing manifest entry with your own. All you need to do is add the new entry in manifest files and you can call any custom action or pages.

'user_signup' => array(
'route' => '/signup/:action/*',
'defaults' => array(
'module' => 'user',
'controller' => 'signup',
'action' => 'index'
)
),'reqs' => array('action' => '(index|statistic|ndaupload|ndasign)')

The manifest entry allow to adding your custom configuration. You can use these entry to call application request from anywhere in your website.

Manifest Notes:-

  • “page-url”, “new-url?anything” are considered separate pages. If they link to the manifest file, they will all be implicitly cached separately.
  • The manifest attribute should be used on every page of your website. If your manifest file does not have the manifest entry then the browser does not cache the web page URL.
  • Manifest file also reduces the load time of the webpage, as it caches a page.
  • The manifest file can be used to limit the resources. If a “closed” manifest file is used, then only those resources listed in the manifest file can be used to the web page.
  • Manifest file also supports offline access of any website.

Advantages of Manifest File

Using the manifest file application have some advantages, which are given below:

  1. Offline browsing – users can use the application when they’re offline
  2. Speed – cached resources load faster
  3. Reduced server load – the browser will only download updated/changed resources from the server

Conclusion

No matter which platforms you are using you should use manifest file inside your website. The manifest attribute specifies the location of the documents. We can say, using the manifest file, we can make a fast access, Quick response and URL redirecting with the ease.

Hope this will help you to understand Zend Framework routing configurtion. Feel free to contact us if you have any questions or suggestions.

References

Zend Framework
Manifest File
How to create a autocomplete profile question in SocialEngine?

Leave a Comment

Scroll to Top