Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Laravel Application Development Cookbook
Laravel Application Development Cookbook

Laravel Application Development Cookbook: Since Laravel is so versatile, one of the best learning routes is a cookbook. We've included lots of recipes and guidance on building web application, both simple and complex. It's a pick & mix approach that works brilliantly.

eBook
€8.99 €28.99
Paperback
€37.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
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
OR
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

Laravel Application Development Cookbook

Chapter 1. Setting Up and Installing Laravel

In this chapter, we will cover:

  • Installing Laravel as a git submodule

  • Setting up a virtual host and development environment in Apache

  • Creating "clean" URLs

  • Configuring Laravel

  • Using Laravel with Sublime Text 2

  • Setting up your IDE to autocomplete Laravel's namespaces

  • Using Autoloader to map a class name to its file

  • Creating advanced Autoloaders with namespaces and directories

Introduction


In this chapter, we'll learn how to get Laravel up-and-running with ease and make sure it's simple to update when any core changes are made. We'll also get our development and coding environment set up to be very efficient so we can focus on writing great code and not have to worry about issues not related to our applications. Finally, we'll look at some ways to get Laravel to automatically do some work for us so we'll be able to extend our application in very little time.

Installing Laravel as a git submodule


There may be a time when we want to have our Laravel installation separate from the rest of our public files. In this case, installing Laravel as a git submodule would be a solution. This will allow us to update our Laravel files through git without touching our application code.

Getting ready

To get started, we should have our development server running as well as have git installed. In the server's web directory, create a myapp directory to hold our files. Installation will all be done in the command line.

How to do it...

To complete this recipe, follow these steps:

  1. In your terminal or command line, navigate to the root of myapp. The first step is to initialize git and download our project files:

    $ git init
    $ git clone git@github.com:laravel/laravel.git
    
  2. Since all we need is the public directory, move to /laravel and delete everything else:

    $ cd laravel
    $ rm –r app bootstrap vendor
    
  3. Then, move back to the root directory, create a framework directory, and add Laravel as a submodule:

    $ cd ..
    $ mkdir framework
    $ cd framework
    $ git init
    $ git submodule add https://github.com/laravel/laravel.git
    
  4. Now we need to run Composer to install the framework:

    php composer.phar install
    

    Tip

    More information about installing Composer can be found at http://getcomposer.org/doc/00-intro.md. The rest of the book will assume we're using composer.phar, but we could also add it globally and simply call it by typing composer.

  5. Now, open /laravel/public/index.php and find the following lines:

    require __DIR__.'/../bootstrap/autoload.php';
    $app = require_once __DIR__.'/../bootstrap/start.php';
    
  6. Change the preceding lines to:

    require __DIR__.'/../../framework/laravel/bootstrap/autoload.php';
    $app = require_once __DIR__.'/../../framework/laravel/bootstrap/start.php';
    

How it works...

For many, simply running git clone would be enough to get their project going. However, since we want to have our framework act as a submodule, we need to separate those files from our project.

First, we download the files from GitHub, and since we don't need any of the framework files, we can delete everything but our public folder. Then, we create our submodule in the framework directory and download everything there. When that's complete, we run composer install to get all our vendor packages installed.

To get the framework connected to our application, we modify /laravel/public/index.php and change the require paths to our framework directory. That will let our application know exactly where the framework files are located.

There's more...

One alternative solution is to move the public directory to our server's root. Then, while updating our index.php file, we'll use __DIR__ . '/../framework/laravel/bootstrap' to include everything correctly.

Setting up a virtual host and development environment in Apache


When developing our Laravel app, we'll need a web server to run everything. In PHP 5.4 and up, we can use the built-in web server, but if we need some more functionality, we'll need a full web stack. In this recipe, we'll be using an Apache server on Windows, but any OS with Apache will be similar.

Getting ready

This recipe requires a recent version of WAMP server, available at http://wampserver.com, though the basic principle applies to any Apache configuration on Windows.

How to do it...

To complete this recipe, follow these steps:

  1. Open the WAMP Apache httpd.conf file. It is often located in C:/wamp/bin/apache/Apach2.#.#/conf.

  2. Locate the line #Include conf/extra/httpd-vhosts.conf and remove the first #.

  3. Move to the extra directory, open the httpd-vhosts.conf file, and add the following code:

    <VirtualHost *:80>
        ServerAdmin {your@email.com}
        DocumentRoot "C:/path/to/myapp/public"
        ServerName myapp.dev
        <Directory "C:/path/to/myapp/public">
            Options Indexes FollowSymLinks
            AllowOverride all
            # onlineoffline tag - don't remove
            Order Deny,Allow
            Deny from all
            Allow from 127.0.0.1
        </Directory>
    </VirtualHost>
  4. Restart the Apache service.

  5. Open the Windows hosts file, often in C:/Windows/System32/drivers/etc, and open the file hosts in a text editor.

  6. At the bottom of the file, add the line 127.0.0.1 myapp.dev.

How it works...

First, in the Apache config file httpd.conf, we uncomment the line to allow the file to include the vhosts configuration files. You can include the code directly in the httpd.conf file, but this method keeps things more organized.

In the httpd-vhosts.conf file, we add our VirtualHost code. DocumentRoot tells the server where the files are located and ServerName is the base URL that the server will look for. Since we only want to use this for our local development, we make sure to only allow access to the localhost with the IP 127.0.0.1.

In the hosts file, we need to tell Windows which IP to use for the myapp.dev URL. After restarting Apache and our browser, we should be able to go to http://myapp.dev and view our application.

There's more...

While this recipe is specific to Windows and WAMP, the same idea can be applied to most Apache installations. The only difference will be the location of the httpd.conf file (in Linux Ubuntu, it's in /etc/apache2) and the path to the public directory for DocumentRoot (in Ubuntu, it might be something like /var/www/myapp/public). The hosts file for Linux and Mac OS X will be located in /etc/hosts.

Creating "clean" URLs


When installing Laravel, the default URL we will use is http://{your-server}/public. If we decide to remove /public, we can use Apache's mod_rewrite to change the URL.

Getting ready

For this recipe, we just need a fresh installation of Laravel and everything running on a properly configured Apache server.

How to do it...

To complete this recipe, follow these steps:

  1. In our app's root directory, add a .htaccess file and use this code:

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteRule ^(.*)$ public/$1 [L]
    </IfModule>
  2. Go to http://{your-server} and view your application.

How it works...

This simple bit of code will take anything we add in the URL and direct it to the public directory. That way, we don't need to manually type in /public.

There's more...

If we decide to move this application to a production environment, this is not the best way to accomplish the task. In that case, we would just move our files outside the web root and make /public our root directory.

Configuring Laravel


After installing Laravel, it's pretty much ready to go without much need for configuration. However, there are a few settings we want to make sure to update.

Getting ready

For this recipe, we need a regular installation of Laravel.

How to do it...

To complete this recipe, follow these steps:

  1. Open /app/config/app.php and update these lines:

    'url' => 'http://localhost/,
    'locale' => 'en',
    'key' => 'Seriously-ChooseANewKey',
  2. Open app/config/database.php and choose your preferred database:

    'default' => 'mysql',
    'connections' => array(
        'mysql' => array(
            'driver'    => 'mysql',
            'host'      => 'localhost',
            'database'  => 'database',
            'username'  => 'root',
            'password'  => '',
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
            ),
        ),
  3. In the command line, go to the root of the app and make sure the storage folder is writable:

    chmod –R 777 app/storage
    

How it works...

Most of the configuration will happen in the /app/config/app.php file. While setting the URL isn't required, and Laravel does a great job figuring it out without setting it, it's always good to remove any work from the framework that we can. Next, we set our location. If we choose to provide localization in our app, this setting will be our default. Then, we set our application key, since it's best to not keep the default.

Next, we set which database driver we'll be using. Laravel comes with four drivers out of the box: mysql, sqlite, sqlsrv (MS SQL Server), and pgsql (Postgres).

Finally, our app/storage directory will be used for keeping any temporary data, such as sessions or cache, if we choose. To allow this, we need to make sure the app can write to the directory.

There's more...

For an easy way to create a secure application key, remove the default key and leave it empty. Then, in your command line, navigate to your application root directory and type:

php artisan key:generate

That will create a unique and secure key and automatically save it in your configuration file.

Using Laravel with Sublime Text 2


One of the most popular text editors used for coding is Sublime Text. Sublime has many features that make coding fun, and with plugins, we can add in Laravel-specific features to help with our app.

Getting ready

Sublime Text 2 is a popular code editor that is very extensible and makes writing code effortless. An evaluation version can be downloaded from http://www.sublimetext.com/2.

We also need to have the Package Control package installed and enabled in Sublime, and that can be found at http://wbond.net/sublime_packages/package_control/installation.

How to do it...

For this recipe, follow these steps:

  1. In your menu bar, go to Preferences then Package Control:

  2. Choose Install Package:

  3. Search for laravel to see the listing. Choose Laravel 4 Snippets and let it install. After it's complete, choose Laravel-Blade and install it.

How it works...

The Laravel snippets in Sublime Text 2 greatly simplify writing common code, and it includes pretty much everything we'll need for application development. For example, when creating a route, simply start typing Route and a list will pop up allowing us to choose which route we want, which then automatically completes the rest of the code we need.

There's more...

Installing the Laravel-Blade package is helpful if we use the Blade template system that comes with Laravel. It recognizes Blade code in the files and will automatically highlight the syntax.

Setting up your IDE to autocomplete Laravel's namespaces


Most IDEs (Integrated Development Environment) have some form of code completion as part of the program. To get Laravel's namespaces to autocomplete, we may need to help it recognize what the namespaces are.

Getting ready

For this recipe, we'll be adding namespaces to the NetBeans IDE, but the process will be similar with others.

How to do it...

Follow these steps to complete this recipe:

  1. Download the following pre-made file that lists the Laravel namespaces: https://gist.github.com/barryvdh/5227822.

  2. Create a folder anywhere on your computer to hold this file. For our purposes, we'll add the file to C:/ide_helper/ide_helper.php:

  3. After creating a project with the Laravel framework, navigate to File | Project Properties | PHP Include Path:

  4. Click on Add Folder… and then add the folder at C:/ide_helper.

  5. Now when we start typing the code, the IDE will automatically suggest code to complete:

How it works...

Some IDEs need help understanding the syntax of a framework. To get NetBeans to understand, we download a list of all the Laravel classes and options. Then, when we add it to the Include Path, NetBeans will automatically check the file and show us the autocomplete options.

There's more...

We can have the documents downloaded and updated automatically using Composer. For installation instructions, visit https://github.com/barryvdh/laravel-ide-helper.

Using Autoloader to map a class name to its file


Using Laravel's ClassLoader, we can easily include any of our custom class libraries in our code and have them readily available.

Getting ready

For this recipe, we need to set up a standard Laravel installation.

How to do it...

To complete this recipe, follow these steps:

  1. In the Laravel /app directory, create a new directory named custom, which will hold our custom classes.

  2. In the custom directory, create a file named MyShapes.php and add this simple code:

    <?php
    class MyShapes {
        public function octagon() 
        {
            return 'I am an octagon';
        }
    }
  3. In the /app/start directory, open global.php and update ClassLoader so it looks like this:

    ClassLoader::addDirectories(array(
    
        app_path().'/commands',
        app_path().'/controllers',
        app_path().'/models',
        app_path().'/database/seeds',
        app_path().'/custom',
    
    ));
  4. Now we can use that class in any part of our application. For example, if we create a route:

    Route::get('shape', function()
    {
        $shape = new MyShapes;
        return $shape->octagon();
    });

How it works...

Most of the time, we will use Composer to add packages and libraries to our app. However, there may be libraries that aren't available through Composer or custom libraries that we want to keep separate. To accomplish this, we need to dedicate a spot to hold our class libraries; in this case, we create a directory named custom and put it in our app directory.

Then we add our class files, making sure the class names and filenames are the same. This could either be classes we create ourselves or maybe even a legacy class that we need to use.

Finally, we add the directory to Laravel's ClassLoader. When that's complete, we'll be able to use those classes anywhere in our application.

See also

  • The Creating advanced Autoloaders with namespaces and directories recipe

Creating advanced Autoloaders with namespaces and directories


If we want to be sure that our custom classes don't conflict with any other class in our app, we will need to add them to a namespace. Using the PSR-0 standard and Composer, we can easily autoload these classes into Laravel.

Getting ready

For this recipe, we need to set up a standard Laravel installation.

How to do it...

To complete this recipe, follow these steps:

  1. Inside the /app directory, create a new directory named custom, and inside of custom, create a directory named Custom, and in Custom, create a directory named Shapes.

  2. Inside the /app/custom/Custom/Shapes directory, create a file named MyShapes.php and add this code:

    <?php namespace Custom\Shapes;
    
    class MyShapes {
        public function triangle() 
        {
            return 'I am a triangle';
        }
    }
  3. In the root of the application, open the composer.json file and locate the autoload section. Update it so it looks like this:

    "autoload": {
        "classmap": [
        "app/commands",
            "app/controllers",
            "app/models",
            "app/database/migrations",
            "app/database/seeds",
            "app/tests/TestCase.php",
        ],
        "psr-0": {
            "Custom": "app/custom"
        }
    }
  4. Open the command line and run dump-autoload on Composer:

    php composer.phar dump-autoload
    
  5. Now we can call that class by using its namespace. For example, if we create a route:

    Route::get('shape', function()
    {
        $shape = new Custom\Shapes\MyShapes;
        return $shape->triangle();
    });

How it works...

Namespaces are a powerful addition to PHP, and they allow our classes to be used without us having to worry about their class names interfering with other class names. By autoloading namespaces in Laravel, we could create a complex group of classes and never have to worry about class names conflicting with other namespaces.

For our purposes, we're loading the custom class through composer, and the PSR-0 standard of autoloading.

There's more...

To further extend the use of our namespaced class, we could use the IoC to bind it to our app. More information can be found in the Laravel documentation at http://laravel.com/docs/ioc.

See also

  • The Using Autoloader to map a class name to its file recipe

Left arrow icon Right arrow icon

Key benefits

  • Install and set up a Laravel application and then deploy and integrate third parties in your application
  • Create a secure authentication system and build a RESTful API
  • Build your own Composer Package and incorporate JavaScript and AJAX methods into Laravel

Description

When creating a web application, there are many PHP frameworks from which to choose. Some are very easy to set up, and some have a much steeper learning curve. Laravel offers both paths. You can do a quick installation and have your app up-and-running in no time, or you can use Laravel's extensibility to create an advanced and fully-featured app.Laravel Application Development Cookbook provides you with working code examples for many of the common problems that web developers face. In the process, it will also allow both new and existing Laravel users to expand their knowledge of the framework.This book will walk you through all aspects of Laravel development. It begins with basic set up and installation procedures, and continues through more advanced use cases. You will also learn about all the helpful features that Laravel provides to make your development quick and easy. For more advanced needs, you will also see how to utilize Laravel's authentication features and how to create a RESTful API.In the Laravel Application Development Cookbook, you will learn everything you need to know about a great PHP framework, with working code that will get you up-and-running in no time.

Who is this book for?

The Laravel Application Development Cookbook is for PHP developers who are new to Laravel or development frameworks in general, as well as experienced Laravel developers looking to expand their knowledge. This book assumes that the reader has some familiarity with PHP.

What you will learn

  • Set up a virtual host and development environment in Apache
  • Set up a user authentication system
  • Use the RESTful controllers
  • Debug and profile your application
  • Store and retrieve content from the cloud
  • Use the Artisan command-line tool
  • Integrate JavaScript and jQuery into your Laravel app
  • Write unit tests for Laravel
Estimated delivery fee Deliver to Bulgaria

Premium delivery 7 - 10 business days

€25.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Oct 25, 2013
Length: 272 pages
Edition : 1st
Language : English
ISBN-13 : 9781782162827
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
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
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Bulgaria

Premium delivery 7 - 10 business days

€25.95
(Includes tracking information)

Product Details

Publication date : Oct 25, 2013
Length: 272 pages
Edition : 1st
Language : English
ISBN-13 : 9781782162827
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.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
€189.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
€264.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 37.99
Laravel Application Development Cookbook
€37.99
Total 37.99 Stars icon
Banner background image

Table of Contents

11 Chapters
Setting Up and Installing Laravel Chevron down icon Chevron up icon
Using Forms and Gathering Input Chevron down icon Chevron up icon
Authenticating Your Application Chevron down icon Chevron up icon
Storing and Using Data Chevron down icon Chevron up icon
Using Controllers and Routes for URLs and APIs Chevron down icon Chevron up icon
Displaying Your Views Chevron down icon Chevron up icon
Creating and Using Composer Packages Chevron down icon Chevron up icon
Using Ajax and jQuery Chevron down icon Chevron up icon
Using Security and Sessions Effectively Chevron down icon Chevron up icon
Testing and Debugging Your App Chevron down icon Chevron up icon
Deploying and Integrating Third-party Services into Your Application 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.9
(10 Ratings)
5 star 30%
4 star 30%
3 star 40%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




saad guessous Dec 08, 2013
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is the kind of book I wish was available 6 months ago when I encountered Laravel for the first time and started to experiment with it. For somebody starting development with Laravel and having no prior experience with the framework this book is a must, as the recipes included covers most of the stuff ranging from beginner to intermediate level and beyond, with whole chapters dealing with basics as installing and setting up, authentication, data storage and querying using ORM, ajax, security, testing and debugging. Although Laravel is a familiar framework, I decided to re-read the chapters on controllers, views, form handling and users authentication and to my surprise I picked up a whole bunch of new information in the process, the chapters on composer and particularly the one on ajax where welcomed as I was seeking similar info on the net... And the one thing I appreciate the most is to have all of the information in one bundle, as it makes the book a good reference to go back to.I'm really pleased with the outcome and I feel the author did a really great job and lastly I would wholeheartedly recommend this book to any developer wishing to use Laravel for his upcoming project.
Amazon Verified review Amazon
DJ Far Oct 31, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This a very well-written, easy to follow reference which serves exactly the purpose for which I bought it. It's not a basic primer on Laravel, but a how-to for specific tasks you always need to do with a framework. A very good collection of recipes.
Amazon Verified review Amazon
Manuel Ambulo Mar 22, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Excellent book
Amazon Verified review Amazon
リク丸 Mar 26, 2014
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Laravelの開発と基本、事例などがわかります。Laravel4のネット上のマニュアル&APIリファレンスなどとあわせて見るのに適していると思います。対象は、Laravel未経験者です。(ディープな内容は書いていないです)php経験は必要ですが他のフレームワーク経験がなくても読める本かと思いました。Laravelのクセなどがつかめます。(ネットマニュアル & 記事だけだと若干不安なので読んで見ました)一部で少し情報が古い点もありますが、最新のLaravel4開発でもほとんど通用すると思います。
Amazon Verified review Amazon
Gregory M. Sanders Dec 17, 2013
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Terry Matula’s Laravel Application Development Cookbook is a good resource for PHP developers who are familiar with MVC code frameworks and want to quickly get up to speed on Laravel. It’s especially valuable for developers like me who have heard about many time-saving dev tools (such as SublimeText2) but never had time to dig into them. This book is totally hands-on, which is great when you’re trying to get a working app up in a short time frame. This isn’t an MVC introduction -- If you haven’t worked with MVC frameworks before, this book might not confuse you, but it might leave you wondering why the code works the way it does.Laravel Application Development Cookbook embraces the reality that today’s dev tools work in integrated development environments, not as self-standing pieces of software. Specific tools used in the book include: Git (with Laravel installed as a submodule) for source control; Apache web server; Sublime Text and NetBeans IDE; Composer as a dependency package installer; OAuth (optionally) for user authorization; Fluent for query building; jQuery for AJAX and general UI functions; Bootstrap for dynamic styling and sizing; PHPUnit for unit testing. Due to the hands-on nature of the narrative, and its reliance on specific tools that integrate well with Laravel, this cookbook’s sample code might be awkward for devs who already have a favorite development toolkit and aren’t interested in adopting new pieces. But for me, this was a huge bonus: learn Laravel and simultaneously get a painless introduction to some good productivity tools. Laravel Application Development Cookbook also gives a good introduction to some of Laravel’s specialized built-in tools: Artisan command line; Eloquent ORM and Blade templating engine, for example.Most of the book’s chapters cover common situations such as creating a textbox with autocomplete, returning data as JSON, validating a user login and displaying nested views. There are also some niche use cases like reading RSS feeds as a data source.This book is well worth reading if you’re interested in trying out Laravel for the first time, or using it more effectively. Full disclosure: I received a free preview copy of this book. I jumped at the chance to preview this because Laravel has gotten good reviews and I needed a good book to get me started on it. I was definitely not disappointed.
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 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