DEV Community

Hamid Semix
Hamid Semix

Posted on • Updated on

Getting started with the yuga-framework part 1

There is a full list of frameworks most of which are php frameworks, these frameworks help in Rapid Application
Development. However, some of these frameworks are really had to get started with, have complex paradigms,
and some are not good enough for an advanced php developer. This is where the yuga-framework comes in handy.

In this tutorial, I will introduce you to yuga-framework a framework for PHP that leverages between a beginner and advanced developer. Yuga-framework can be used just to develop apis or fully fledged web applications.

What is Yuga-framework?

Yuga is a php framework that is ideal for rapid web app development, It can be used to develop apis or an entire web application like mentioned earlier. It supports all HTTP verbs or methods (GET, POST, PUT, DELETE, PATCH, and custom ones). It has automatic form validation, automatic cross site request forgery protection on routes and does not force the user to use Route methods if they aren't coming from that background. You can learn and advance with the framework.

Steps needed to get started with yuga-framework

Step 1: Install Composer

Install composer (php package manager) if you don't already have it on your machine from here

Step 2: Install Yuga Framework From Packagist using composer

To get started you just need one command

composer create-project yuga/yuga Blog

Step 3: Run the application

To run the application we have just created using composer, we cd to Blog and open the project in terminal or console, type the following yuga command, Oooh, Did I forget to mention that the framework comes with its own console application, I just did.

php yuga start

Step 4: See output

To see what the yuga start command has done, go to your browser and visit http://localhost:8000

Step Finale

Open the project in your favorite editor, in my case it's vs code. Let's try to see the file structure

  • app
    • Controllers
    • helpers (optional)
    • Middleware (created automatically when you make a middleware using a yuga command).
    • Models
    • Providers (houses your application service providers)
    • ViewModels (Where view models live). The framework is well integrated with ViewModels so that's where our logic will reside
  • boot (framework specific) do not touch
  • config (Where the configuration settings of you application reside). Feel free to alter and see how the application changes
  • database (Where migrations live)
  • environment (Where environment settings live)
  • mailables (Where files that can be sent as emails reside). This can change
  • public (Where you should point your server instance)
  • resouces (Where views are saved)
  • routes
    • web.php (A file that holds all our routes)
  • storage
  • tests

Latest comments (0)