```php
<?php

require_once '../../core/api_bootstrap.php';

$data = Request::post();

try {

    Validator::required($data,[
        'name',
        'price',
        'validity_days'
    ]);

    $db = new Database();
    $conn = $db->connect();

    $query = "

        INSERT INTO plans
        (
            name,
            price,
            categories_allowed,
            daily_lead_limit,
            validity_days,
            description
        )

        VALUES
        (
            :name,
            :price,
            :categories_allowed,
            :daily_lead_limit,
            :validity_days,
            :description
        )

    ";

    $stmt = $conn->prepare($query);

    $stmt->execute([

        ':name'=>$data['name'],
        ':price'=>$data['price'],
        ':categories_allowed'=>$data['categories_allowed'] ?? null,
        ':daily_lead_limit'=>$data['daily_lead_limit'] ?? 0,
        ':validity_days'=>$data['validity_days'],
        ':description'=>$data['description'] ?? null

    ]);

    Response::success([
        "plan_id"=>$conn->lastInsertId()
    ],"Plan created successfully");

}
catch(Exception $e){

    Logger::log("system.log",$e->getMessage());

    Response::error("Server error",500);

}