### Apiato Environment File Setup Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-9.x/getting-started/installation.md Copies the example environment file to create the actual environment configuration file for the project. ```shell cp .env.example .env ``` -------------------------------- ### Homestead: Map Domains to Separate Project Directories Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-9.x/getting-started/installation.md Example configuration for mapping different domains to separate project directories, illustrating a multi-app setup. ```text - map: api.apiato.test to: "/{full-path-to}/apiato/public" - map: apiato.test to: "/{full-path-to}/clients/web/user" - map: admin.apiato.test to: "/{full-path-to}/clients/web/admin" ``` -------------------------------- ### Homestead: Start Virtual Machine Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-9.x/getting-started/installation.md Starts the Vagrant virtual machine and provisions it with the necessary configurations. ```shell homestead up --provision ``` -------------------------------- ### Create New Apiato Project with Apiato Installer Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md Creates a new Apiato project using the globally installed Apiato Installer. Offers options for selecting containers, version, and Git initialization. ```shell apiato new my-api ``` -------------------------------- ### Laradock Docker Setup Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md Steps to set up the Apiato development environment using Laradock. This includes navigating to the laradock directory, copying the environment file, and starting the necessary Docker containers. ```shell cd laradock ``` ```shell cp env-example .env ``` ```shell docker-compose up -d nginx mysql redis beanstalkd ``` -------------------------------- ### Laradock Docker Setup Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-11.x/getting-started/installation.md Steps to set up the Apiato development environment using Laradock. This includes navigating to the laradock directory, copying the environment file, and starting the necessary Docker containers. ```shell cd laradock ``` ```shell cp env-example .env ``` ```shell docker-compose up -d nginx mysql redis beanstalkd ``` -------------------------------- ### Starting Vagrant Virtual Machine Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md Command to start the Laravel Homestead virtual machine and provision it with the configured settings. ```shell homestead up --provision ``` -------------------------------- ### Database Setup Commands Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-12.x/getting-started/installation.mdx Commands for setting up the database, including creating a SQLite file and running migrations. ```bash touch database/database.sqlite ``` ```bash php artisan migrate ``` -------------------------------- ### Apiato Installation via Composer Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-9.x/getting-started/installation.md Installs the latest stable version of Apiato using Composer. This is the recommended method for project setup. ```shell composer create-project apiato/apiato my-api ``` -------------------------------- ### Create New Apiato Project with Git Initialization Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md Creates a new Apiato project and initializes a Git repository, committing the base skeleton. Requires Git to be installed and configured. ```shell apiato new my-api --git ``` -------------------------------- ### Install Apiato Installer Globally Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md Installs the Apiato Installer as a global Composer dependency, allowing for easier project creation and configuration. ```shell composer global require apiato/installer ``` -------------------------------- ### Apiato Documentation Setup (ApiDocJs) Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-9.x/getting-started/installation.md Installs ApiDocJs, a tool for generating API documentation. This step is optional if you prefer a different documentation generator. ```shell npm install ``` -------------------------------- ### Homestead Sites Configuration Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md Example configurations for the 'sites' section in the Homestead.yaml file to map domains to specific directories within the Apiato project or related client applications. ```yaml sites: - map: api.apiato.test to: /{full-path-to}/apiato/public - map: apiato.test to: /{full-path-to}/clients/web/user - map: admin.apiato.test to: /{full-path-to}/clients/web/admin ``` ```yaml sites: - map: api.apiato.test to: /{full-path-to}/apiato/public - map: apiato.test to: /{full-path-to}/apiato/public - map: admin.apiato.test to: /{full-path-to}/apiato/public ``` -------------------------------- ### Create New Apiato Project with Composer Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md Creates a new Apiato project using Composer. Requires PHP and Composer to be installed. ```shell composer create-project apiato/apiato my-api ``` -------------------------------- ### Starting Vagrant Virtual Machine Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-11.x/getting-started/installation.md Command to start the Laravel Homestead virtual machine and provision it with the configured settings. ```shell homestead up --provision ``` -------------------------------- ### Create New Apiato Project with Git Initialization Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-11.x/getting-started/installation.md Creates a new Apiato project and initializes a Git repository, committing the base skeleton. Requires Git to be installed and configured. ```shell apiato new my-api --git ``` -------------------------------- ### User Registration Response Headers Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-11.x/getting-started/installation.md This snippet shows example response headers for the user registration endpoint. ```text Access-Control-Allow-Origin → ... Cache-Control → ... Connection → keep-alive Content-Language → en Content-Type → application/json Date → Wed, 11 Apr 2000 22:55:88 GMT Server → nginx Transfer-Encoding → chunked Vary → Origin X-Powered-By → PHP/7.7.7 X-RateLimit-Limit → 30 X-RateLimit-Remaining → 29 ``` -------------------------------- ### Create New Apiato Project with Custom Branch Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md Creates a new Apiato project, initializes Git, and sets the initial branch name. Requires Git to be installed and configured. ```shell apiato new my-api --git --branch="main" ``` -------------------------------- ### Homestead: Map Multiple Domains to Project Directory Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-9.x/getting-started/installation.md Example configuration for mapping multiple domains ('api.apiato.test', 'apiato.test', 'admin.apiato.test') to the 'apiato/public' directory. ```text - map: api.apiato.test to: "/{full-path-to}/apiato/public" - map: apiato.test to: "/{full-path-to}/apiato/public" - map: admin.apiato.test to: "/{full-path-to}/apiato/public" ``` -------------------------------- ### Migrate Apiato Database Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md Runs database migrations to set up the necessary tables for the Apiato application. ```shell php artisan migrate ``` -------------------------------- ### Create New Apiato Project via Apiato Installer Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-11.x/getting-started/installation.md Creates a new Apiato project using the globally installed Apiato Installer. This method offers interactive prompts for container selection and version control. ```shell apiato new my-api ``` -------------------------------- ### Homestead: Map Domain to Project Directory Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-9.x/getting-started/installation.md Example configuration for mapping the 'api.apiato.test' domain to the 'apiato/public' directory within the Homestead configuration. ```text sites: - map: api.apiato.test to: "/{full-path-to}/apiato/public" ``` -------------------------------- ### Apiato Manual Installation via Git Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-9.x/getting-started/installation.md Clones the Apiato repository using Git for manual installation. This method is an alternative to Composer installation. ```shell git clone https://github.com/apiato/apiato.git ``` -------------------------------- ### Run Apiato Tests Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md Executes the project's tests using PHPUnit. Ensure `phpunit.xml` is configured correctly. ```shell vendor/bin/phpunit ``` -------------------------------- ### Install Apiato Installer Globally Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-11.x/getting-started/installation.md Installs the Apiato Installer as a global Composer dependency, allowing you to create new Apiato projects with additional options like selecting containers and choosing the development version. ```shell composer global require apiato/installer ``` -------------------------------- ### Apiato Default Endpoints Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-12.x/getting-started/installation.mdx Default URLs to access the Apiato web interface and API endpoints for testing the setup. ```APIDOC Web Interface: http://apiato.test API Endpoints: http://api.apiato.test http://api.apiato.test/v1 ``` -------------------------------- ### Homestead Sites Configuration Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-11.x/getting-started/installation.md Example configurations for the 'sites' section in the Homestead.yaml file to map domains to specific directories within the Apiato project or related client applications. ```yaml sites: - map: api.apiato.test to: /{full-path-to}/apiato/public - map: apiato.test to: /{full-path-to}/clients/web/user - map: admin.apiato.test to: /{full-path-to}/clients/web/admin ``` ```yaml sites: - map: api.apiato.test to: /{full-path-to}/apiato/public - map: apiato.test to: /{full-path-to}/apiato/public - map: admin.apiato.test to: /{full-path-to}/apiato/public ``` -------------------------------- ### User Registration Endpoint (cURL) Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-11.x/getting-started/installation.md This snippet demonstrates how to register a new user using the /v1/register endpoint with cURL. It includes example request headers and form data. ```shell curl -X POST -H "Accept: application/json" -H "Cache-Control: no-cache" -F "email=John@Doe.me" -F "password=so-secret" -F "name=John Doe" "http://api.apiato.test/v1/register" ``` -------------------------------- ### Create New Apiato Project via Composer Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-11.x/getting-started/installation.md This command creates a new Apiato project using Composer. Ensure you have PHP and Composer installed. It downloads the latest stable version of Apiato and its dependencies. ```shell composer create-project apiato/apiato my-api ``` -------------------------------- ### Apiato Dependency Installation Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-9.x/getting-started/installation.md Installs all project dependencies, including those for Apiato containers, after cloning the repository. ```shell composer install ``` -------------------------------- ### Apiato Installation from Development Branch Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-9.x/getting-started/installation.md Installs the Apiato project from the 'dev-master' branch, providing access to the latest development features. Requires regular syncing with the upstream master branch. ```shell composer create-project apiato/apiato my-api dev-master ``` -------------------------------- ### Apiato Documentation Generation Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-12.x/getting-started/installation.mdx Commands to set up and generate API documentation using ApiDocJs. Requires Node.js and npm. ```bash npm install ``` ```bash php artisan apiato:apidoc ``` -------------------------------- ### Troubleshooting Homestead Sub-domains Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md A troubleshooting command for Homestead if sub-domains are not resolving correctly, involving halting and then restarting the virtual machine with provisioning. ```shell homestead halt && homestead up --provision ``` -------------------------------- ### Apiato Database Migration Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-9.x/getting-started/installation.md Runs all database migrations to set up the necessary tables and schema for the Apiato application. ```shell php artisan migrate ``` -------------------------------- ### Project Setup and Git Initialization Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/contribution-guide.md Commands to create a new Apiato project, initialize Git, and set up remote repositories for local development and contribution. ```bash composer create-project apiato/apiato project-a git init git remote add origin git@bitbucket.org:username/repo.git git remote set-url origin git@bitbucket.org:username/project-a.git git remote add upstream git@github.com:username/apiato.git git add . git commit -m 'first commit' ``` -------------------------------- ### Project Setup and Git Initialization Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-11.x/contribution-guide.md Commands to create a new Apiato project, initialize Git, and set up remote repositories for local development and contribution. ```bash composer create-project apiato/apiato project-a git init git remote add origin git@bitbucket.org:username/repo.git git remote set-url origin git@bitbucket.org:username/project-a.git git remote add upstream git@github.com:username/apiato.git git add . git commit -m 'first commit' ``` -------------------------------- ### Create New Apiato Project Source: https://github.com/apiato/documentation/blob/master/docs/getting-started/installation.mdx Command to create a new Apiato project using Composer. This is the initial step for starting a new project. ```bash composer create-project apiato/apiato example-app ``` -------------------------------- ### Create Apiato Project Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-12.x/getting-started/installation.mdx Use Composer to create a new Apiato project. This command downloads the Apiato framework and sets up a new project directory. ```bash composer create-project apiato/apiato example-app ``` -------------------------------- ### Install Passport for OAuth Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md Generates encryption keys and creates OAuth clients for secure token generation. ```shell php artisan passport:install ``` -------------------------------- ### Start Local Development Server Source: https://github.com/apiato/documentation/blob/master/README.md Starts a local development server for live previewing changes. The server automatically reloads when code is modified. ```bash yarn start ``` -------------------------------- ### Generate Apiato Documentation Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md Generates API documentation using ApiDocJs. Assumes ApiDocJs is installed via NPM. ```shell php artisan apiato:apidoc ``` -------------------------------- ### Create New Apiato Project Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-13.x/getting-started/installation.mdx Command to create a new Apiato project using Composer. This is the initial step for setting up a new application. ```bash composer create-project apiato/apiato example-app ``` -------------------------------- ### Install Dependencies Source: https://github.com/apiato/documentation/blob/master/README.md Installs the necessary project dependencies using Yarn. ```bash yarn ``` -------------------------------- ### Assign Permissions to Role Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md Assigns all seeded permissions to a specified role (e.g., 'admin'). ```shell php artisan apiato:permissions:toRole admin ``` -------------------------------- ### Git Initialization and Remote Setup Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-9.x/contribution-guide.md Initializes Git in a project and sets up remote repositories for origin (your project) and upstream (Apiato repository). ```bash git init git remote add origin git@bitbucket.org:username/repo.git git remote set-url origin git@bitbucket.org:username/project-a.git git remote add upstream git@github.com:username/apiato.git ``` -------------------------------- ### Seed Apiato Database Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md Seeds the database with initial data, including default roles and users. ```shell php artisan db:seed ``` -------------------------------- ### App Configuration Example Source: https://github.com/apiato/documentation/blob/master/docs/prologue/upgrade-guide.mdx This snippet demonstrates the base configuration for bootstrap/app.php in Apiato 13, utilizing a fluid API for customization. It includes setting up providers, routing, middleware, and commands. ```php create(); return Application::configure(basePath: $basePath) ->withProviders($apiato->providers()) ->withEvents($apiato->events()) ->withRouting( web: $apiato->webRoutes(), channels: __DIR__ . '/../app/Ship/Broadcasts/channels.php', health: '/up', then: static fn () => $apiato->registerApiRoutes(), ) ->withMiddleware(function (Middleware $middleware) { // Previously applied via app/Ship/Kernels/HttpKernel class $middleware->api(append: [ ValidateJsonContent::class, ProcessETag::class, ]); // Uncomment and adjust these if using web routes: // $middleware->redirectUsersTo(fn ($request): string => action(HomePageController::class)); // $middleware->redirectGuestsTo(fn ($request): string => action([LoginController::class, 'showForm'])); }) ->withCommands($apiato->commands()) ->withExceptions(static function (Exceptions $exceptions) {}) ->create(); ``` -------------------------------- ### User Registration Response Header Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md This snippet shows the expected HTTP headers returned after a successful user registration. ```text Access-Control-Allow-Origin: ... Cache-Control: ... Connection: keep-alive Content-Language: en Content-Type: application/json Date: Wed, 11 Apr 2000 22:55:88 GMT Server: nginx Transfer-Encoding: chunked Vary: Origin X-Powered-By: PHP/7.7.7 X-RateLimit-Limit: 30 X-RateLimit-Remaining: 29 ``` -------------------------------- ### Apiato API Root Response Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md This snippet shows the expected JSON response when accessing the root of the Apiato API. ```json [ "Welcome to Apiato" ] ``` -------------------------------- ### Laradock: Run Docker Containers Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-9.x/getting-started/installation.md Starts the necessary Docker containers for the Apiato development environment, including Nginx, MySQL, Redis, and Beanstalkd. ```shell docker-compose up -d nginx mysql redis beanstalkd ``` -------------------------------- ### Apiato API v1 Root Response Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md This snippet shows the expected JSON response when accessing the v1 root of the Apiato API. ```json { "message": "Welcome to apiato (API V1)." } ``` -------------------------------- ### Build Static Website Source: https://github.com/apiato/documentation/blob/master/README.md Generates the static website files in the 'build' directory, ready for deployment. ```bash yarn build ``` -------------------------------- ### User Registration API Response Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-9.x/getting-started/installation.md Example JSON response received after a successful user registration API call. It includes user details such as ID, name, email, and timestamps. ```json { "data": { "object": "User", "id": 77, "name": "Mahmoud Zalt", "email": "apiato@mail.com", "confirmed": null, "nickname": "Mega", "gender": "male", "birth": null, "social_auth_provider": null, "social_id": null, "social_avatar": { "avatar": null, "original": null }, "created_at": { "date": "2017-04-05 16:17:26.000000", "timezone_type": 3, "timezone": "UTC" }, "updated_at": { "date": "2017-04-05 16:17:26.000000", "timezone_type": 3, "timezone": "UTC" }, "roles": { "data": [] } } } ``` -------------------------------- ### User Registration Response Body Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md This snippet shows the expected JSON response body after a successful user registration, including the created user's data and metadata. ```json { "data": { "object": "User", "id": "7VgmkMw7rR2pWO5j", "name": "John Doe", "email": "John@Doe.me", "email_verified_at": null, "gender": null, "birth": null, "created_at": "2021-04-12T13:33:24.000000Z", "updated_at": "2021-04-12T13:33:24.000000Z", "readable_created_at": "1 second ago", "readable_updated_at": "1 second ago" }, "meta": { "include": [ "roles" ], "custom": [] } } ``` -------------------------------- ### Comprehensive Apiato Configuration Example Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-13.x/digging-deeper/advance-configuration.mdx An example demonstrating a comprehensive Apiato configuration, including base path, shared paths, configurations, routing, factories, and final creation. ```php $basePath = dirname(__DIR__); $apiato = Apiato::configure(basePath: $basePath) ->useSharedPath(join_paths($basePath, 'app/Ship')) ->withConfigs( shared_path('Configs'), ...glob($basePath . '/app/Containers/*/*/Configs', GLOB_ONLYDIR) )->withRouting(function (Routing $routing) use ($basePath) { $routing->prefixApiUrlsWith('api/') ->loadApiRoutesFrom( ...glob($basePath . '/app/Containers/*/*/UI/API/Routes', GLOB_ONLYDIR) ) ->loadWebRoutesFrom( ...glob($basePath . '/app/Containers/*/*/UI/WEB/Routes', GLOB_ONLYDIR) ); })->withFactories() ->create(); ``` -------------------------------- ### Laravel Homestead Configuration Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md Instructions for configuring Laravel Homestead for Apiato. This involves creating the Homestead configuration file and mapping domains to the project's public directory. ```shell vendor/bin/homestead make ``` -------------------------------- ### Host File Configuration for Laradock Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md Configuration for the hosts file to map local domains to the Docker IP address when using Laradock. This ensures that local domains resolve correctly to the running containers. ```text 127.0.0.1 apiato.test 127.0.0.1 api.apiato.test 127.0.0.1 admin.apiato.test ``` -------------------------------- ### Host File Configuration for Vagrant (Homestead) Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-10.x/getting-started/installation.md Configuration for the hosts file to map local domains to the Vagrant IP address when using Laravel Homestead. This ensures that local domains resolve correctly to the virtual machine. ```text 192.168.10.10 apiato.test 192.168.10.10 api.apiato.test 192.168.10.10 admin.apiato.test ``` -------------------------------- ### Sample Action Source: https://github.com/apiato/documentation/blob/master/versioned_docs/version-9.x/getting-started/overview.md Encapsulates the core business logic. This example demonstrates a simple action that returns a string 'Hello World!'. Actions can return various data types. ```php