Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
CodeIgniter 2 Cookbook
CodeIgniter 2 Cookbook

CodeIgniter 2 Cookbook: As a PHP developer, you may have wondered how much difference the Codeigniter framework might make when creating web applications. Now you can find out with a host of customizable recipes ready to insert into your own work.

eBook
$29.69 $32.99
Paperback
$43.99 $54.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

CodeIgniter 2 Cookbook

Chapter 1. CodeIgniter Basics

In this chapter, we will cover:

  • Downloading and installing CodeIgniter

  • Basic configuration options

  • Managing CodeIgniter on different environments

  • Managing database settings in different environments

  • Securing system files

  • Removing index.php from the address bar using .htaccess

  • Installing and using Sparks

Introduction


CodeIgniter is an easy to use, easy to set up PHP-based framework which you can use to build pretty much any web-based application you can think of. There is a little bit of configuration needed before we can start to use CodeIgniter; however, this chapter will walk you through downloading, installing, and understanding the basic configuration of CodeIgniter to help you quickly get up and running.

Downloading and installing CodeIgniter


First things first, you will need a copy of CodeIgniter to be getting on with. There are several choices: you can download a nightly build, an older version, or the current stable release. However, it's recommended that you go for the latest stable version.

How to do it...

You can get your hands on the latest stable version of CodeIgniter through the following link:

http://codeigniter.com/downloads/

CodeIgniter will be offered as a compressed archive file. Once CodeIgniter has been downloaded, copy the package to your web folder, and unpack it as you would normally unpack an archive on your system. Once you've done this, you'll need to set some configuration options, which we'll look at next.

Basic configuration options


Configuring CodeIgniter is a lot easier than many other web frameworks available and does not require you to resort to using the command line. All you need to quickly get up and running is access to several files in the application/config/ folder. These are a few of the suggested settings which will get your CodeIgniter installation ready without too much fuss.

How to do it...

Open the file in your localhost of development environment: /path/to/codeigniter/application/config/config.php and find the following lines:

$config["base_url"]:

The value should be the full web address (the address that is written in your browser address bar) to the CodeIgniter installation. So if you are working in your localhost, the value should be: http://localhost/path/to/codeigniter/.

Tip

Remember to begin with a http:// and always put the trailing / slash.

If you've amended your host's file to use a domain name rather than localhost, then be sure to replace localhost with that domain name:

$config["encryption_key"]

If you wish to use either the Session or Encryption classes in your application, the encryption key must be set. The encryption key is simply a string of characters used by CodeIgniter to encrypt various types of communication:

$config["global_xss_filtering"]

The preceding code line specifies whether cross-site script filtering should be applied to the Get, Post, or Cookie variables. For the sake of security, this should be set to TRUE, especially in a live environment:

$config["csrf_protection"]

The preceding code line specifies whether a cookie token is set, which if TRUE will be checked every time a form is submitted from the client side. In a live environment, it should be set to TRUE:

$config["log_threshold"]

The preceding code line specifies whether you want to write to logs, and if so, the type of information you wish to write to those logs. For example:

  • 0: No errors are written to logs as logging is deactivated

  • 1: Error messages only (this will include PHP errors also)

  • 2: Debugging messages only

  • 3: Informational messages only

  • 4: All types of messages

The following code line is the path to the folder in which you wish to save log files:

$config["log_path"] = "/path/to/log/file"

How it works...

CodeIgniter will now respond and function according to the settings provided.

Managing CodeIgniter on different environments

In some cases, it may be useful to adapt your configuration files so that they can function on several servers or environments without having to edit or maintain each time they are moved. For example, the configuration settings you may have on your localhost are very likely to be different than those on a live or production server. Setting the configuration files correctly will save you a lot of time rather than manually switching between the two.

How to do it...

Open the /path/to/codeigniter/application/config/config.php file and replace the $config["base_url"] line with the following:

switch($_SERVER["SERVER_NAME"]) {
    case "localhost":
        $config["base_url"] = "http://localhost/path/to/codeigniter/";
        break;
    case "mydomain.com":
        $config["base_url"] = "http://www.mydomain.com/";
        break;
}

How it works...

This is simply a case/switch statement with a SERVER_NAME check. The base_url value is set according to the server that the CodeIgniter application or project is running on.

Managing database settings on different environments

If you plan to use a database for your CodeIgniter application, then you'll need to maintain the correct connection settings. CodeIgniter keeps these settings in the database.php config file.

How to do it...

  1. Open the /path/to/codeigniter/application/config/database.php file. Chances are that the only values that need to change are the standard hostname, username, password of your database server, and the database name.

  2. Find the line that defines $active_group, which specifies the specific database settings to use for a particular hosting environment. You can switch between settings by a case/switch test similar to that used previously, for example, the following code tests for a particular server and loads the appropriate settings:

    switch($_SERVER["SERVER_NAME"]) {
        case "localhost":
            $active_group = "testing";
            break;
        case "mydomain.com":
            $active_group = "default"
        break;
    }
    
    $db["default"]["hostname"] = "localhost";
    $db["default"]["username"] = "root";
    $db["default"]["password"] = "";
    $db["default"]["database"] = "database_name";
    $db["default"]["dbdriver"] = "mysql";
    $db["default"]["dbprefix"] = "";
    $db["default"]["pconnect"] = TRUE;
    $db["default"]["db_debug"] = FALSE;
    $db["default"]["cache_on"] = FALSE;
    $db["default"]["cachedir"] = "";
    $db["default"]["char_set"] = "utf8";
    $db["default"]["dbcollat"] = "utf8_general_ci";
    $db["default"]["swap_pre"] = "";
    $db["default"]["autoinit"] = TRUE;
    $db["default"]["stricton"] = FALSE;
    
    $db["testing"]["hostname"] = "localhost";
    $db["testing"]["username"] = "root";
    $db["testing"]["password"] = "";
    $db["testing"]["database"] = "database_name";
    $db["testing"]["dbdriver"] = "mysql";
    $db["testing"]["dbprefix"] = "";
    $db["testing"]["pconnect"] = TRUE;
    $db["testing"]["db_debug"] = TRUE;
    $db["testing"]["cache_on"] = FALSE;
    $db["testing"]["cachedir"] = "";
    $db["testing"]["char_set"] = "utf8";
    $db["testing"]["dbcollat"] = "utf8_general_ci";
    $db["testing"]["swap_pre"] = "";
    $db["testing"]["autoinit"] = TRUE;
    $db["testing"]["stricton"] = FALSE;
    
    $active_record – Specifies if you require active record support.  By default it is set to TRUE.

How it works...

All we're doing is defining the environment that the site is running on. In the preceding example, we specify two environments: either default or testing, and apply specific settings for them. So, let's look at some variable definitions.

Common values

The standard database access options are shown in the following table:

Option name

Valid options

Description

$db["default"]["hostname"]

Usually localhost

This is the server that the database sits on

$db["default"]["username"]

 

The database access username

$db["default"]["password"]

 

The password for the database

$db["default"]["database"]

 

The name of the database

Other values

The following table shows the options that normally remain unchanged from the default setting but are here just incase you wish to change them:

Option name

Valid options

Description

$db["default"]["dbdriver"]

mysql

This is the type of DBMS you're using—the recipes in this book use MySQL. The value must be all lowercase.

$db["default"]["dbprefix"]

Default: mysql, but may also be postgre, odbc, and so on

Sometimes you may wish to add a prefix to a database table name, for example, a blogging application might prefix its tables with the word "blog" so the posts table would become blog_posts.

$db["default"]["pconnect"]

TRUE/FALSE

Specifies whether you wish to maintain a persistent connection to the database.

$db["default"]["db_debug"]

TRUE/FALSE

Specifies whether you wish to display database errors on the screen. It is blank by default, but for security purposes should be set to FALSE on a live environment and TRUE while in development.

$db["default"]["cache_on"]

TRUE/FALSE

Specifies whether you want database query caching enabled.

$db["default"]["cachedir"]

 

Specifies the absolute file path to your database query cache.

$db["default"]["char_set"]

utf8

Specifies the character set that CodeIgniter will use with the database.

$db["default"]["dbcollat"]

utf8_general_ci

Specifies the character collation that CodeIgniter will use with the database.

$db["default"]["port"]

3306

Default MySQL port. This option is not included by default, and if you wish to use a specific port for your database connection, you'll need to manually write in this line and set the value.

We will look at accessing data from a database in more detail in Chapter 6, Working with Databases.

Securing the system files

On live environments, it is strongly recommended that you move your system folder out of the web root to prevent malicious access.

How to do it...

  1. Move the system folder either by the command line or using your computer's GUI to a folder outside the publicly accessible web folder. The method to do this will be different depending on which system you are using, but I'm sure you know how to move a folder, so we will not discuss that here.

  2. After you have moved the system folder, you will need to update the $system_path variable in the path/to/codeigniter/index.php file. Look for and find the following line:

    $system_path = "path/to/system/folder";

    Amend the line to reflect the new location of the system folder. So if, for example, you moved the system folder up one level out of the web root, you should write the following line:

    $system_path = "../system";

How it works...

By moving the system folder out of the web root, you are protecting it against access via the Internet (as much as possible). The system folder is much more unlikely to be accessed in a location outside of the web root than inside.

Removing index.php from the address bar using .htaccess

It is possible to remove the index.php file from the web browser address bar when CodeIgniter is running.

How to do it...

Create or open a .htaccess file. If a .htaccess file does not already exist, you can create one as follows:

Linux/Mac

  1. Open a terminal window and type: touch/path/to/CodeIgniter/.htaccess.

Windows

  1. Create a text file in your CodeIgniter root, naming it file.htaccess.

  2. Press Windows + R to open the run dialogue.

  3. Enter the following command and click on OK:

    ren "C:\path\to\CodeIgniter\file.htaccess" .htaccess
  4. Once your .htaccess file is opened, write the following lines at the top of the file:

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond $1 !^(index\.php|images|robots\.txt)
    RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>

How it works...

This rule in the .htaccess file will remove the index.php file from the browser's address bar. CodeIgniter's index.php file is still called but it is not shown to the user in the address bar of the browser.

Installing and using Sparks

It has been the case for a long time now that to find and use extensions, libraries, and other useful snippets of code for CodeIgniter, you have to search the Internet and download code from various places such as blogs, code repositories, and so on. Useful installations for CodeIgniter were spread across the Internet and as such, may have been hard to locate. Sparks acts as a single point of reference for extensions for CodeIgniter. It's simple to install and use, and contains thousands of useful add-ons for CodeIgniter.

How to do it...

If you are using a MAC or Linux, then the command line interface is open to you.

  1. Using the terminal application on your system, navigate to the root of your CodeIgniter application and enter the following line:

    php -r "$(curl -fsSL http://getsparks.org/go-sparks)"

    If your installation was successful, you should see something similar to:

    user@server:/path/to/codeigniter$ php -r "$(curl -fsSL http://getsparks.org/go-sparks)"
    Pulling down spark manager from http://getsparks.org/static/install/spark-manager-0.0.9.zip ...
    Pulling down Loader class core extension from http://getsparks.org/static/install/MY_Loader.php.txt ...
    Extracting zip package ...
    Cleaning up ...
    Spark Manager has been installed successfully!
    Try: `php tools/spark help`

    If you are using Windows, then you will need to download Sparks and unpack it manually. To do that, perform the following instructions or check out the instructions on the GetSparks website for the latest version:

  2. Create a folder named tools in the top level (root) of your CodeIgniter directory.

  3. Visit the following URL: http://getsparks.org/install.

  4. Go to the Normal Installation section and download the Sparks package.

  5. Unpack the download into the tools folder you created in step 1.

  6. Download the Loader class extension from: http://getsparks.org/static/install/MY_Loader.php.txt.

  7. Rename the MY_Loader.php.txt file to MY_Loader.php and move it to the application/core/MY_Loader.php directory in your CodeIgniter instance.

  8. Now that Sparks is installed in your CodeIgniter instance, you can begin to install extensions and packages.

    To install a package from Sparks, type the following in the command line:

    php tools/spark install [Package Version] Spark Name

    Here, Package Version is the specific version of the Spark you wish to install. You are not required to state the version, and by leaving it out, Sparks will download the latest version by default. Spark Name is the name of the Spark you wish to install, so for example, to install the example-spark (Version 1.0.0) that comes with the default installation, type in the command line:

    php tools/spark install -v1.0.0 example-spark

    If the installation was successful, you should see something similar to:

    user@server:/path/to/codeigniter$ php tools/spark install -v1.0.0 example-spark 
    [ SPARK ] Retrieving spark detail from getsparks.org
    [ SPARK ] From Downtown! Retrieving spark from Mercurial repository at https://url/of/the/spark/repo
    [ SPARK ] Spark installed to ./sparks/example-spark/1.0.0 - You're on fire!

How it works...

You should now be ready to begin making use of your Spark. Be sure to read the Readme file or documentation that is included with your Spark for its correct usage.

Left arrow icon Right arrow icon

Key benefits

  • Customizable code that can be used in your own applications right away
  • Recipes that will help you solve your Codeigniter issues efficiently and effectively
  • Each recipe comes with a full code example, and where necessary, the Model and View files are included too

Description

As a developer, there are going to be times when you'll need a quick and easy solution to a coding problem. CodeIgniter is a powerful open source PHP framework which allows you to build simple yet powerful full-feature web applications. CodeIgniter 2 Cookbook will give you quick access to practical recipes and useful code snippets which you can add directly into your CodeIgniter application to get the job done. It contains over 80 ready-to-use recipes that you can quickly refer to within your CodeIgniter application or project.This book is your complete guide to creating fully functioning PHP web applications, full of easy-to-follow recipes that will aid you in any aspect of developing with CodeIgniter. CodeIgniter 2 Cookbook takes you from the basics of CodeIgniter, through e-commerce features for your applications, and ends by helping you ensure that your environment is secure for your users and SEO friendly to draw in customers. Starting with installation and setup, CodeIgniter 2 Cookbook provides quick solutions to programming problems that you can directly include in your own projects. You will be moving through databases, EU Cookie Law, caching, and everything else in-between with useful, ready-to-go recipes. You will look at image manipulation using the Image Manipulation library, user management (building a simple CRUD interface), switching languages on the fly according to the user preference, caching content to reduce server load, and much more.

Who is this book for?

CodeIgniter 2 Cookbook is for intermediate to advanced PHP developers who want to begin using the powerful CodeIgniter framework to create web applications. Familiarity with CodeIgniter isn't essential, but it will be useful if you have been introduced to the framework before.

What you will learn

  • Build simple yet powerful PHP and CodeIgniter applications
  • Create e-commerce features to add to your application
  • Manipulate images ‚Äì crop, rotate, and add watermarks
  • Secure your user environment
  • Provide a forgot password functionality to users
  • Optimize your SEO and search capabilities
  • Manage money flow in your application
  • Work with the EU Cookie Law (confirming Cookies from the user)
  • Use database migrations to roll back changes and advance to newer database versions
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 13, 2013
Length: 306 pages
Edition : 1st
Language : English
ISBN-13 : 9781782162308
Vendor :
EllisLab
Languages :

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Publication date : Dec 13, 2013
Length: 306 pages
Edition : 1st
Language : English
ISBN-13 : 9781782162308
Vendor :
EllisLab
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 114.37 142.97 28.60 saved
CodeIgniter Web Application Blueprints
$39.19 $48.99
Programming with CodeIgniter MVC
$31.19 $38.99
CodeIgniter 2 Cookbook
$43.99 $54.99
Total $ 114.37 142.97 28.60 saved Stars icon

Table of Contents

11 Chapters
CodeIgniter Basics Chevron down icon Chevron up icon
User Management Chevron down icon Chevron up icon
Creating E-commerce Features Chevron down icon Chevron up icon
Email, HTML Table, and Text Libraries Chevron down icon Chevron up icon
Managing Data In and Out Chevron down icon Chevron up icon
Working with Databases Chevron down icon Chevron up icon
Creating a Secure User Environment Chevron down icon Chevron up icon
Calendaring, Right Place, and Right Time Chevron down icon Chevron up icon
Extending the Core Chevron down icon Chevron up icon
Working with Images Chevron down icon Chevron up icon
SEO, Caching, and Logging Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.8
(6 Ratings)
5 star 16.7%
4 star 50%
3 star 33.3%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Hugo Leon Mar 04, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Excellent book. I started a project with my new team based on this platform, never worked with CI before and it took me less than 2 weeks to begin working with them in production. And only had two chapters read!.
Amazon Verified review Amazon
NazHus Mar 23, 2014
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Covers the fundamentals of the MVC framework, good set of recipes that targets competent developers. However i wouldn't suggest this book for beginners starting out with CodeIgniter.
Amazon Verified review Amazon
Mikel Viera Apr 03, 2014
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
There are very few bugs in the code. Outstanding Users Guide you can download which lists every function with a code example."CodeIgniter 2 Cookbook" is a detailed overview of CodeIgniter. The topics in a different, perhaps, more understandable format. This is a reading book. You're not meant to sit at your computer, and input the code with this book.Starting with installation and setup, quick solutions to programming problems. Databases, EU Cookie Law, caching, and everything else in-between with useful, ready-to-go recipes. Also Image manipulation using the Image Manipulation library, user management (building a simple CRUD interface), switching languages on the fly according to the user preference, caching content to reduce server load, and much more. Very useful!!! I will rate this book 4 stars, because it is very readable, and there is value to be gained from the read. It's an excellent detailed overview. There are pearls and tidbits that you pick up in the book that make it worthwhile. You get a good overall feel of CodeIgniter from the book. It's also nice to read a computer book without necessarily running to the computer every two pages. You don't need your computer to benefit from this book, unlike the "Professional CodeIgniter" book .
Amazon Verified review Amazon
JamesR Mar 23, 2014
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
I recommend this book to anyone who is planning on using CodeIgniter to build web apps. The sections on the first steps towards scaling your app, and extending CodeIgniter itself make this book stand out from the crowd. Today's Web 2.0 is demanding more with less. CodeIgniter, an up-and-coming PHP-based Web application development framework that leaves a little footprint, rises to the challenge.This is a must have book for reference - covers everything in detail.
Amazon Verified review Amazon
Kender Feb 01, 2014
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
This book covers the basics, and provides detailed code to do most necessary functions for a basic website, but be warned it is not for the PHP nor HTML beginner and the HTML is not up to current standards (I understand that some nuances need to be skipped for brevity and to keep to the main point of the book, but no mention of the need to edit for proper "semantic" HTML).If you know the basics already though, and are looking to get into a framework like CodeIgniter, then this is a very good book to learn how the MVC framework is written, and how to write code for use in an MVC framework (and it provides user and shopping cart functions within the book, so bonus there).So, while I do believe the book is very useful to learn the MVC framework, CI specifically, I recommend you be more thoughtful in the output that you generate when writing your own. Also, with CodeIngiter looking for new ownership, and its future up in the air with the framework (who knows what the new ownership may do), you may be more better suited to look into another framework, such as Laravel ([...]).
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the digital copy I get with my Print order? Chevron down icon Chevron up icon

When you buy any Print edition of our Books, you can redeem (for free) the eBook edition of the Print Book you’ve purchased. This gives you instant access to your book when you make an order via PDF, EPUB or our online Reader experience.

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
Modal Close icon
Modal Close icon