diff --git a/app/Services/TaskService.php b/app/Services/TaskService.php
index 173d8313..29461e09 100644
--- a/app/Services/TaskService.php
+++ b/app/Services/TaskService.php
@@ -2,12 +2,13 @@
 
 namespace App\Services;
 
+use Carbon\Carbon;
+use App\Helpers\Sort;
 use App\Helpers\Response;
 use Illuminate\Support\Str;
 use App\Helpers\Collaborator;
 use App\Services\TodoService;
 use App\Repositories\TaskRepository;
-//use App\Services\ServiceTrait;
 
 class TaskService extends TaskRepository
 {
@@ -112,9 +113,9 @@ public function getLatestTask()
     public function toggleStatus($id)
     {
         $task = $this->todoService->find($id); // Get the Task
-
+        // Set new date if it is null or empty, else set back to empty
         $archived = array_key_exists('archived_at', $task)
-            && $task['archived_at']  ?  '' : Carbon::now(); // Set new date if it is null or empty, else set back to empty
+            && $task['archived_at']  ?  '' : Carbon::now();
 
         // prepare the payload
         $data = array();
@@ -147,7 +148,7 @@ public function taskCollection($request)
 
         $sort = $request->order;
         if ($sort) {
-        $allTasks = collect($allTasks->sortBy('created_at'))->toArray;
+            $allTasks = collect($allTasks->sortBy('created_at'))->toArray;
         }
 
         $time = time();
@@ -157,7 +158,6 @@ public function taskCollection($request)
                 $end_date = $value['end_date'];
                 $convert_date = strtotime($end_date);
                 if ($convert_date >= $time) {
-
                     $arr = $value;
                 }
             }
@@ -196,10 +196,14 @@ public function markTask($request, $todoId)
             // Send Mail
             $user_ids = Collaborator::listAllUsersInTodo($todo);
             $collab = new Collaborator;
-            $collab->sendMails($user_ids, 'Task Added', 'A task with the title' . $request->title . 'has been marked in the todo');
+            $collab->sendMails(
+                $user_ids,
+                'Task Added',
+                'A task with the title' . $request->title . 'has been marked in the todo'
+            );
             return $todoWithId;
         } else {
-           abort(500, $result);
+            abort(500, $result);
         }
     }
 
@@ -227,14 +231,17 @@ public function add($request, $todoId)
         $result = $this->todoService->update($todo, $todoId);
 
         if (isset($result['modified_documents']) && $result['modified_documents'] > 0) {
-
             // Publish To Centrifugo
             $todoWithId = array_merge(['_id' => $todoId], $todo);
             $this->publishToRoomChannel($todo['channel'], $todoWithId, "Task", "create");
             // Send Mail
             $user_ids = Collaborator::listAllUsersInTodo($todo);
             $collab = new Collaborator;
-            $collab->sendMails($user_ids, 'Task Added', 'A task with the title'.$request->title.'has been added to the todo');
+            $collab->sendMails(
+                $user_ids,
+                'Task Added',
+                'A task with the title'.$request->title.'has been added to the todo'
+            );
 
             return $todoWithId;
         }
diff --git a/composer.json b/composer.json
index 4f6a9280..90264a8b 100644
--- a/composer.json
+++ b/composer.json
@@ -18,7 +18,9 @@
         "laravel/sail": "^1.0.1",
         "mockery/mockery": "^1.4.2",
         "nunomaduro/collision": "^5.0",
-        "phpunit/phpunit": "^9.3.3"
+        "phpstan/phpstan": "^0.12.99",
+        "phpunit/phpunit": "^9.3.3",
+        "squizlabs/php_codesniffer": "^3.6"
     },
     "autoload": {
         "psr-4": {
diff --git a/composer.lock b/composer.lock
index c06d7e5e..95ba1f41 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "6cadd819a6415b190ae2704ced6e6c8b",
+    "content-hash": "516abf23f5901c10fa6d2236db0182f0",
     "packages": [
         {
             "name": "asm89/stack-cors",
@@ -6053,6 +6053,70 @@
             },
             "time": "2021-09-10T09:02:12+00:00"
         },
+        {
+            "name": "phpstan/phpstan",
+            "version": "0.12.99",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/phpstan/phpstan.git",
+                "reference": "b4d40f1d759942f523be267a1bab6884f46ca3f7"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b4d40f1d759942f523be267a1bab6884f46ca3f7",
+                "reference": "b4d40f1d759942f523be267a1bab6884f46ca3f7",
+                "shasum": ""
+            },
+            "require": {
+                "php": "^7.1|^8.0"
+            },
+            "conflict": {
+                "phpstan/phpstan-shim": "*"
+            },
+            "bin": [
+                "phpstan",
+                "phpstan.phar"
+            ],
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "0.12-dev"
+                }
+            },
+            "autoload": {
+                "files": [
+                    "bootstrap.php"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "description": "PHPStan - PHP Static Analysis Tool",
+            "support": {
+                "issues": "https://github.com/phpstan/phpstan/issues",
+                "source": "https://github.com/phpstan/phpstan/tree/0.12.99"
+            },
+            "funding": [
+                {
+                    "url": "https://github.com/ondrejmirtes",
+                    "type": "github"
+                },
+                {
+                    "url": "https://github.com/phpstan",
+                    "type": "github"
+                },
+                {
+                    "url": "https://www.patreon.com/phpstan",
+                    "type": "patreon"
+                },
+                {
+                    "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan",
+                    "type": "tidelift"
+                }
+            ],
+            "time": "2021-09-12T20:09:55+00:00"
+        },
         {
             "name": "phpunit/php-code-coverage",
             "version": "9.2.7",
@@ -7438,6 +7502,62 @@
             ],
             "time": "2020-09-28T06:39:44+00:00"
         },
+        {
+            "name": "squizlabs/php_codesniffer",
+            "version": "3.6.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
+                "reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/f268ca40d54617c6e06757f83f699775c9b3ff2e",
+                "reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e",
+                "shasum": ""
+            },
+            "require": {
+                "ext-simplexml": "*",
+                "ext-tokenizer": "*",
+                "ext-xmlwriter": "*",
+                "php": ">=5.4.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
+            },
+            "bin": [
+                "bin/phpcs",
+                "bin/phpcbf"
+            ],
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "3.x-dev"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Greg Sherwood",
+                    "role": "lead"
+                }
+            ],
+            "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
+            "homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
+            "keywords": [
+                "phpcs",
+                "standards"
+            ],
+            "support": {
+                "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
+                "source": "https://github.com/squizlabs/PHP_CodeSniffer",
+                "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
+            },
+            "time": "2021-10-11T04:00:11+00:00"
+        },
         {
             "name": "theseer/tokenizer",
             "version": "1.2.1",
@@ -7498,5 +7618,5 @@
         "php": "^7.3|^8.0"
     },
     "platform-dev": [],
-    "plugin-api-version": "2.1.0"
+    "plugin-api-version": "2.0.0"
 }
diff --git a/pre-commit b/pre-commit
new file mode 100644
index 00000000..4bb9bf4a
--- /dev/null
+++ b/pre-commit
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+
+# get bash colors and styles here:
+# http://misc.flogisoft.com/bash/tip_colors_and_formatting
+C_RESET='\e[0m'
+C_RED='\e[31m'
+C_GREEN='\e[32m'
+C_YELLOW='\e[33m'
+
+function __run() #(step, name, cmd)
+{
+    local color output exitcode
+
+    printf "${C_YELLOW}[%s]${C_RESET} %-20s" "$1" "$2"
+    output=$(eval "$3" 2>&1)
+    exitcode=$?
+
+    if [[ 0 == $exitcode || 130 == $exitcode ]]; then
+        echo -e "${C_GREEN}OK!${C_RESET}"
+    else
+        echo -e "${C_RED}NOK!${C_RESET}\n\n$output"
+        exit 1
+    fi
+}
+
+modified="git diff --diff-filter=M --name-only --cached  | grep \".php$\""
+ignore="resources/lang,resources/views,bootstrap/helpers,database/migrations,bin"
+phpcs="vendor/bin/phpcs --report=code --colors --report-width=80 --standard=PSR2 --ignore=${ignore}"
+
+__run "1/3" "php lint" "${modified} | xargs -r php -l"
+__run "2/3" "code sniffer" "${modified} | xargs -r ${phpcs}"
+__run "3/3" "phpstan" "${modified} | xargs -r vendor/bin/phpstan analyse"