How do you create a composer.json file by using this command in your project?

We need to create a folder in xampp server. I am going to the local server (C /Drive ) then going to xampp server. Here at htdocs. Then here we will create a project folder that will run on the server.

I will need a text editor I am using Visual studio code you can use notepad, notepad++, sublime text anything.

Then Visual Studio Code has to be opened. After that open folder cmp has to go there location me c/drive/xampp/htdocs/ after that select project folder cmp. Here my project folder has been opened.

Here we create a file index.php and write the code of the PHP in it. And if we need to start the server, then we have to go to Windows Search and search xampp. After that open it and start the Apache server.

After this, we have to run on the tube, for that we have to do a few searches in the search in Windows Manu and open the Run Administrator.

After that, we have to go to my own project of CMD.
Tagged : / /

What is composer.JSON? How do I use it?

A file is generated from the composer tool. Which is the main file of the whole project which we call the composer file. The extension file is composer.json. It is the main composer.json that defines your project requirements.

How to setup a new or existing package

You can also say how to create a composer.json file in a Project to make it a package.

  • Ussing composer init Command
  • Manually Creating composer.json file

Ussing composer init Command

composer init – It is used to set up a new or existing package. The init command creates a basic composer.json file in the current directory.
Every project is a package.
As soon as you a composer.json in a directory, that directory is a package.

composer.json

Package name – in order to make that package installable you need to give it a name. It consists of vendor name and project name, separated by/. The name can contain any character, including white spaces, names are case insensitive, the convention is all lowercase and dashes for word separation. It is required for published packages(libraries).

Syntax:- vendorname/packagename

Ex:- devopsschool/dev

Description- A short description of the package. Usually, this is one line long. It is required for published packages(libraries).

Authors – The authors of the package. This is an array of objects.

Each author object can have the following properties:

  • name: The author’s name. Usually their real name.
  • email: The author’s email aaddress.
  • homepage: An URL to the author’s website.
  • role: The author’s role in the prject (e.g. developer or translator)

Minimum Stability – Composer accepts these flags as minimum-stability settings. The defualt setting for minimun-stability if not provided is assumed to be stable, but you sould define any of the flags down the hierarchy.

  • stable (most stable)
  • re
  • beta
  • alpha
  • dev (least stable)

Package Type – Package types are used for custom installation logic. If you have a package that needs some special logic, you can define a custom type. It default to library.

  • Library
  • Project
  • Metaapackage
  • Composer-plugin

License – The license of the package. This can be either a string or an array of strings.

Ex:- MIT

Tagged : / / / /

How to use Composer in Laravel?

What is Composer?

Composer is a tool dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) than for you. Composer is not a package manager in the same a Yum or Apt are. Yes, it deals with “packages” or libraries, but it manages them on a per-project basis, installing them in a directory (e.g. vendor) inside your project. By default, it does not install anything globally. Thus, it is a dependency manager. It does however support a “global” project for convenience via the global command.

Why use Composer?

  • You have a project that depend on a number of libraries.
  • Some of thoes libraries epen on other libraries.
  • Enable you to declare the libraries you depend on.
  • Find out which versions of which packeges can and need to be installed, and installs them.

You have a project that depends on several libraries. The libraries that I used in my project to create PDF are also supported by other libraries. It gives you the urgency to declare those libraries that you are on these libraries as it will manage them all for you. It will find out which packages are required for the project we have. Which version of the package is required and will install it for you.

Tagged : / / / /

DOS Command to display time without prompting for New time

scmuser created the topic: DOS Command to display time without prompting for New time

I think most of us know the DOS command “time/T” which displays current system time without prompting for new time.

But If one needs more granular output, say in HH:MM:SS format, here is a way out, use “echo %TIME%” which expands to current time using same format as TIME command.

There are so many other things which can be echoed. For example, try any of the following variables:
%CD% – expands to the current directory string.

%DATE% – expands to current date using same format as DATE command.

%RANDOM% – expands to a random decimal number between 0 and 32767.

%ERRORLEVEL% – expands to the current ERRORLEVEL value

%CMDEXTVERSION% – expands to the current Command Processor Extensions version number.

%CMDCMDLINE% – expands to the original command line that invoked the Command Processor.

%PATH% – expands the current PATH variable.

Tagged :

Check the exit code of the last command in batch file?

rajeshkumar created the topic: check the exit code of the last command in batch file?

Test for a return code greater than or equal to 1:

if ERRORLEVEL 1 echo Error
or

if %ERRORLEVEL% GEQ 1 echo Error

or test for a return code equal to 0:

if %ERRORLEVEL% EQU 0 echo OK

You can use other commands such as GOTO where I show echo
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Get the application exit code from a Windows command line?

rajeshkumar created the topic: get the application exit code from a Windows command line?

Two ways…

(1) The results are stored in a pseudo environment variable named errorlevel so…

echo Exit Code is %errorlevel%
(2) and a special syntax of the if command:

if errorlevel
see if /? for details.

For Example

@echo off
my_nify_exe.exe
if errorlevel 1 (
echo Failure Reason Given is %errorlevel%
exit /b %errorlevel%
)
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

rajeshkumar replied the topic: get the application exit code from a Windows command line?

:: Exit if a required file is missing
@echo off
If not exist MyimportantFile.txt Exit /b
Echo If we get this far the file was found

:: Set the error level to 5
@echo off
call :setError
echo %errorlevel%
goto :eof

:setError
Exit /B 5

To make this more flexible you can change the subroutine to set any errorlevel like this:

:setError
Exit /B %1

Now you can call the subroutine: call :setError 6 replacing 6 with whatever value you need the errorlevel to be set to.

EXIT is an internal command.
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Useful Command for Process and Jobs in Unix/Linux

rajeshkumar created the topic: Useful Command for Process and Jobs in Unix/Linux

List out all background Job running in machine i.e. list current jobs
> jobs

How to sent Job into Background ie background the suspended job
> bg

How to run background jobs on foreground

1. Find out the job number using “jobs” command
2. Type follwoing fg %jobnumber

Whats the differnce between control c and control z in Linux

^C – kill the job running in the foreground
^Z – suspend the job running in the foreground

To kill a suspended or background process
> kill %jobnumber

To kill a job running in the foreground
> sleep 100
^C

List out all background job running by each user
ps -u

To see every process on the system using standard syntax:
> ps -ef

To see every process on the system using BSD syntax:
> ps ax

To print a process tree:
> ps -ejH

To get info about threads:
> ps -eLf

To see every process running as root (real & effective ID) in user format:
> ps -U root -u root u
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Find command return type

scmuser created the topic: Find command return type
I am looking for following answer if anybody can help me out…

How to Return a message when a file is not found using find command? OR
Find command return type OR
when the file is not found i want it to return some value OR

tpatil replied the topic: Re: Find command return type
You can use exit code of find command to return the message.

e..g.

find . -name abc.txt > dev/null

if test $? -eq 0
then
echo "File found"
else
echo "File Not Found"
fi

Hope this helps…

rajeshkumar replied the topic: Re: Find command return type
Hi..

I guess following script will not work. The problem here is find command does always return true value no matter if find is available or not.

this is unique things in find command.

I feel we should go ahead in this way.

find . -name raj.txt > raj.txt
counter= `cat abc.txt | wc -l'

if [$counter -gt 0]
then
echo "File is found"
else
echo "File is not found"
fi

please let us your inputs on this
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

tpatil replied the topic: Re: Find command return type
Thanks Rajesh…You are right. I tried with my code. Find always retuns 0 though file not found.

Tagged :

Expect command in unix /linux?

scmuser created the topic: expect command in unix /linux?
Hello,
I am doing a project which asks me to enter password 4 times in a row. I need to enter the same password 4 times. My target is to enter password once and apply it 4 times.
My friend told me to use “expect” command. Can you please give me a sample code to do so.

sample command :- $ ssh @(like :ssh root@127.0.0.1)
enter ‘s password:

Could somebody plz tell me where the command “expect” is used. and wud appreciate if you can write a simple standalone script that uses this command. thanks

rajeshkumar replied the topic: Re: expect command in unix /linux?

Tagged :