UKVI Documentation

website·Indexed 29 days ago

https://ukvi-stable.gitlab.io/ukvi-docs/

Documentation for UKVI, a web-based software solution in the UK designed for employee sponsorship license management. Includes guides on project setup, code and Git standards, authorization processes such as signup, and technical reference materials.

Tokens
2.9K
Snippets
14
Records
27
Agent score
73%

What's inside UKVI

  1. Overview of UKVI software purpose and compliance

    UKVI is a web-based software solution designed for UK companies (primarily in the Care Industry) to manage employee sponsorship licenses, candidate onboarding, and employee records. Its primary purpose is to ensure compliance with UK government requirements by tracking and monitoring the expiration dates of critical documents for sponsored employees, including:

    • Passports
    • Biometrics
    • Right to Work (RTW) documentation
    • Certificate of Sponsorship (COS)

    Maintaining these records is critical to prevent the cancellation of an employer's license during government audits or home visits.

  2. Implement UKVI Signup backend logic

    The signup process is handled within a single database transaction to ensure atomicity. The sequence of operations is as follows:

    1. Data Persistence:

      • Create a Company record with form attributes and a dummy avatar logo from a 3rd-party API.
      • Create an AuthUser record and generate a verification_token.
      • Assign the 'employer' role via RBAC.
      • Create an AuthUserData record linking user_id, first_name, last_name, and login_company_id, including a dummy avatar in the photo field.
      • Generate and save a random OTP in the AuthUserOtp model.
      • Create an AuditLog entry for the registration event.
      • Create an AuthUserAccessLevel record to bind the user to the company.
    2. Session and Environment Handling:

      • Start a session for the user_email.
      • Development Environment: Set a success session and display the OTP verification directly in the view.
      • Production Environment: Send the OTP to the registered phone number and save a success flash message.
    3. Finalization:

      • Commit the transaction. If an error occurs, generate an error log.
      • Redirect the user to the account verification screen upon success.
  3. Create and manage blog posts in Docusaurus

    Docusaurus blogging features are powered by the @docusaurus/plugin-content-blog plugin. To create blog posts, add Markdown files or folders to the blog directory. Dates are automatically extracted from filenames using the format YYYY-MM-DD-title.md (e.g., 2019-05-30-welcome.md) or by placing an index.md inside a folder named with the date (e.g., 2019-05-30-welcome/index.md). Using folders allows for co-locating images with the post content. Regular authors can be managed via an authors.yml file, and posts support tags.
    # Example filename for date extraction
    2019-05-30-welcome.md
  4. Manage blog posts in Docusaurus

    Docusaurus blogging features are powered by the @docusaurus/plugin-content-blog plugin. To create blog posts, add Markdown files or folders to the blog directory. Dates are automatically extracted from filenames using the format YYYY-MM-DD-title.md or by placing an index.md inside a folder named YYYY-MM-DD-title. Using folders for posts allows for easier co-location of images.
    # Example filename for date extraction
    2019-05-30-welcome.md
  5. Limit blog post preview size in list view

    To limit the amount of content displayed for a blog post in the list view, insert the <!-- truncate --> HTML comment within the post content. Content appearing after this comment will be hidden in the list view and only visible on the full post page.
    This text will appear in the blog list view.
    
    <!-- truncate -->
    
    This text will only appear when the full blog post is opened.
  6. Create and manage blog posts in Docusaurus

    Docusaurus blogging features are powered by the @docusaurus/plugin-content-blog plugin. To create blog posts, add Markdown files or folders to the blog directory. Post dates are automatically extracted from filenames using the format YYYY-MM-DD-title.md (e.g., 2019-05-30-welcome.md) or from an index.md file within a dated folder (e.g., 2019-05-30-welcome/index.md). Using a folder for a blog post allows you to co-locate images with the content. Regular authors can be managed via an authors.yml file.
  7. Create and manage blog posts in Docusaurus

    Docusaurus blogging features are powered by the @docusaurus/plugin-content-blog plugin. To create blog posts, add Markdown files or folders to the blog directory.

    Blog post dates are automatically extracted from filenames using the format YYYY-MM-DD-title.md (e.g., 2019-05-30-welcome.md) or by placing an index.md inside a folder named with that date format (e.g., 2019-05-30-welcome/index.md). Using a folder for a post is recommended when you need to co-locate images with the content.

  8. Follow PHP coding style standards

    Maintain code clarity and consistency by adhering to PSR-1 and PSR-2 coding standards for PHP. Use 4 spaces for indentation and keep line lengths between 80 and 120 characters. Use meaningful variable and function names.
    // Good
    public function calculateTotalPrice($quantity, $unitPrice) {
        return $quantity * $unitPrice;
    }
    
    // Bad
    public function calc($q, $up) {
        return $q * $up;
    }
  9. Create and manage blog posts in Docusaurus

    Docusaurus blogging features are powered by the @docusaurus/plugin-content-blog plugin. To create blog posts, add Markdown files or folders to the blog directory.

    • Dates: The blog post date is automatically extracted from the filename (e.g., 2019-05-30-welcome.md or 2019-05-30-welcome/index.md).
    • Assets: Using a folder for a blog post (e.g., folder-name/index.md) allows you to co-locate images and assets with the post content.
    • Authors: Regular blog authors can be defined in the authors.yml file.
    • Tags: The blog system supports the use of tags for categorization.
  10. Install and initialize the UKVI project

    To set up the UKVI project environment, clone the repository, run the initialization script to select your environment (0 for development, 1 for production), and install dependencies via Composer.
    # Clone the project
    git clone https://gitlab.com/ukvi-stable/ukvi-website-portal.git
    
    # Navigate to project directory
    cd ukvi-website-portal
    
    # Initialize environment (Choose 0 for dev, 1 for prod)
    php init
    
    # Install dependencies
    composer install
  11. Apply naming conventions for classes and databases

    Use descriptive names for classes, methods, variables, and constants. For database tables and columns, follow the Yii2 naming conventions.
    // Good
    class UserController {
        public function actionProfile() {
            // ...
        }
    }
    
    // Bad
    class C1 {
        public function a() {
            // ...
        }
    }
  12. Document PHP classes and methods

    Every function and action must include clear, concise inline comments documenting the purpose and usage. Use DocBlock format to specify parameters, return types, authors, and versioning.
    /**
     * Get company staff email which is associated with branch and licence.
     *
     * @param integer $company_id Company id from whom we have to get all staff users.
     * @param integer $branch_id Branch id from whom we have to get all staff users.
     *
     * @author Faizan Malek
     * @since 1.2    (version name)
     * @return array $emails array of associate branch staff emails .
     */
    public function getBranchStaffEmails($company_id = '', $branch_id = '')
    {
        //Body of function
    }