• Network Status
  • Knowledge Base
  • Homepage
  • support@blazingcdn.com
  • Network Status
  • Knowledge Base
  • Homepage
  • support@blazingcdn.com

BlazingCDN integration with Zend 

28 views 0

Written by Grzegorz Wiosna-Zieliński
January 19, 2021

Zend is a PHP framework for developing web applications that are popular in conjunction with Bootstrap. Before starting the process, there are a number of basic precautions to take:

  1. a copy of the database and resources
  2. selecting a HTTPS domain and securing it with the SSL protocol
  3. creating a CDN domain in BlazingCDN Static format

To do the integration, you need to enable CDN in Zend and define CDN in Bootstrap. Then add the init function to the application / Bootstrap.php Zend file. You will do it as follows:

protected function _initCdn() 
{ 
    Zend_Registry::set(‘cdn_enabled’, true);
    Zend_Registry::set(‘cdn_domain’, ‘cdn00000000.blazingcdn.net.’);
    Zend_Registry::set(‘cdn_protocol’, ‘http’);
}

 

Then create CDN helper:

class Zend_View_Helper_Cdn extends Zend_View_Helper_Abstract
{           
public function cdn($url = null)
{
    $url = (string) $url;
    if(empty($url))
    {
        throw new Exception(‘URL missing’);
    }
    

    $pattern = ‘|^http[s]{0,1}://|i’;        
    if(preg_match($pattern, $url))
    {
        throw new Exception(‘Invalid URL. ‘ .
            ‘Use: /image.jpeg instead of full URI: ‘ .
            ‘http://domain.com/image.jpeg.’
        );
    }

 

    $pattern = ‘|^/|’;        

    if(!preg_match($pattern, $url))
    {
        $url = ‘/’ . $url;
    }

    if(!Zend_Registry::get(‘cdn_enabled’))
    {
        return $url;
    }    
    else
    {
        $uri = Zend_Registry::get(‘cdn_protocol’) . ‘://’ . Zend_Registry::get(‘cdn_domain’) . $url;        return $uri;
    }    
}    
}

 

At the end use the CDN helper in views:

<? echo $this->cdn(‘/image.jpeg’); ?>

which will output:

http://cdn00000000.blazingcdn.net/image.jpeg

See also:

How to integrate BlazingCDN and Magneto
How to integrate BlazingCDN and Joomla 
How to integrate BlazingCDN and Drupal
BlazingCDN integration with XenForo
BlazingCDN integration with X-Cart
BlazingCDN integration with WordPress
BlazingCDN  integration with vBulletin
BlazingCDN integration with Typo3
BlazingCDN integration with Symfony 
BlazingCDN integration with SocialEngine 
BlazingCDN integration with Shopware
BlazingCDN integration with PrestaShop
BlazingCDN integration with Phalcon 
BlazingCDN integration with Perch
BlazingCDN integration with Opencart
BlazingCDN integration with Odoo
BlazingCDN integration with MODX CDN
BlazingCDN integration with Laravel 
BlazingCDN integration with Kirby CDN 
BlazingCDN integration with Kentico 
BlazingCDN integration with IPS
BlazingCDN integration with Grav
BlazingCDN integration with Discourse
BlazingCDN  integration with Craft
BlazingCDN integration with concrete5
BlazingCDN  integration with CodeIgniter
BlazingCDN integration with b2evolution 
BlaizngCDN integration with Ruby on Rails

Was this helpful?

Yes  No
Leave A Comment Cancel reply

Integrations

  • BlazingCDN integration with Zend 
  • Connection to KVS
  • BlazingCDN  integration with CodeIgniter
  • BlazingCDN integration with Phalcon 
  • BlazingCDN integration with Laravel 
  • BlazingCDN integration with Symfony 
View All 30  

Popular Articles

  • How to create account on BlazingCDN?
  • How do I pay for BlazingCDN service?
  • BlazingCDN integration with WordPress
  • How to add new Pull zone?
  • What is Anycast CDN?

KB Categories

  • Account Settings
  • API
  • Billing
  • CDN Static
  • Copyright & Legal
  • Get Started
  • Integrations
  • Other
  • Storage
  • Tools
  • Privacy Policy
  • Terms of Use
  • © 2022 BlazingCDN. All Rights Reserved.

Popular Search:Getting Started