1

I am new to the Zend framework and have many questions.

How do I use the Zend library without using its MVC structure?

I am trying to use only Zend library that available to my all pages and only i need to creating object for using that classes.

For example I want to use only mail class in our script. How can I do it? I am also confused with many questions such as is it compulsory to use Zend framework structure to use the Zend library or can we use the Zend library in our own PHP application...

How do I...

  • Load its whole library?
  • Load specific modules?
  • Create custom functions?

1 Answer 1

2

You can use Zend libraries outside of the framework but they do have dependencies, IE you can't just use the mail library separately. Take a look at composer http://getcomposer.org/. It is a package manager for PHP and installs the required dependencies for various packages automatically such as YUM.

https://packagist.org is the website that hosts these packages available for download, take a look at the Zend Mail library. There are other Zend libraries on their as well, just search Zend.

https://packagist.org/packages/zendframework/zend-mail

If you are struggling to grasp the concept mentioned above take a look at this tutorial:

http://net.tutsplus.com/tutorials/php/easy-package-management-with-composer/

So with composer installed, to download the Zend Mail library with all its dependancies use this composer.json file.

{
    "require": {
        "zendframework/zend-mail": "2.3.*@dev"
    }
}

After running composer update it will produce a folder called vendor that holds all your libraries (in this case only Zend Mail and its dependencies). There will be a special file named autoload.php in the root of this directory.

To actually use the library within your code use

include_once 'vendor/autoload.php';

If you want to download the whole library without the MVC application go to http://framework.zend.com/downloads/latest and select "Zend Framework Minimal Package", here is its description:

Zend Framework Minimal Package

Download a minimal package from zend.com's CDN. Contains only the components in the Zend Framework Standard Library. (Requires registration)

Hope that helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.