Skip to main content
1

System Requirements

Ensure your system meets the following requirements:
  • PHP >= 8.0.2
  • Composer
  • MySQL or PostgreSQL database
  • Web server (Apache, Nginx, etc.)
2

Clone or Download the Repository

Get the source code for the Password Manager API:
git clone https://github.com/JanContrerasDev/gestor-contrasenas.git
cd gestor-contrasenas
3

Install Dependencies

Install all required PHP packages using Composer:
composer install
This will install:
  • Laravel Framework 9.19+
  • Laravel Sanctum 3.0+ (for API authentication)
  • Guzzle HTTP client
  • Development dependencies (PHPUnit, Laravel Pint, etc.)
4

Environment Configuration

Copy the example environment file and generate an application key:
cp .env.example .env
php artisan key:generate
The key:generate command will set the APP_KEY value in your .env file. This key is used for encrypting data and must be set before using the application.
5

Configure Database

Edit your .env file and set your database credentials:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database_name
DB_USERNAME=your_database_user
DB_PASSWORD=your_database_password
Create the database if it doesn’t exist:
mysql -u root -p -e "CREATE DATABASE your_database_name;"
6

Run Database Migrations and Create Passwords Table

Execute the migrations to create the required database tables:
php artisan migrate
This will create the following tables:
  • users - User accounts
  • password_resets - Password reset tokens
  • failed_jobs - Failed queue jobs
  • personal_access_tokens - Sanctum API tokens
The passwords table migration is not included in the repository. You need to create it manually or generate a migration for it.
Create the passwords table:You can create the table manually using this SQL:
CREATE TABLE passwords (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    password VARCHAR(255) NOT NULL,
    sistema VARCHAR(255) NOT NULL,
    usuario VARCHAR(255) NOT NULL,
    status TINYINT DEFAULT 1,
    created_at TIMESTAMP NULL,
    updated_at TIMESTAMP NULL
);
Or generate a Laravel migration:
php artisan make:migration create_passwords_table
Then add this code to the migration file:
public function up()
{
    Schema::create('passwords', function (Blueprint $table) {
        $table->id();
        $table->string('password');
        $table->string('sistema');
        $table->string('usuario');
        $table->tinyInteger('status')->default(1);
        $table->timestamps();
    });
}

public function down()
{
    Schema::dropIfExists('passwords');
}
Run the migration:
php artisan migrate
7

Start the Development Server

Launch the Laravel development server:
php artisan serve
The API will be available at http://localhost:8000
For production deployments, configure your web server (Apache/Nginx) to serve the application instead of using the development server.
8

Verify Installation

Test that the API is running by accessing:
curl http://localhost:8000/api/listPassword
You should receive a JSON response (empty array or list of passwords depending on your data).

Post-Installation

After completing the installation, you should:
  1. Configure authentication - See the Authentication guide
  2. Set up environment variables - See the Configuration guide
  3. Review security settings - Ensure APP_DEBUG=false in production
  4. Configure caching - Set up Redis or Memcached for better performance

Troubleshooting

Permission Issues

If you encounter permission errors, ensure the web server has write access to these directories:
chmod -R 775 storage bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache

Database Connection Failed

Verify your database credentials in .env and ensure the database server is running:
php artisan config:clear
php artisan cache:clear

Composer Install Errors

If composer install fails, try updating Composer:
composer self-update
composer update