Laravel package development with dependacy package - php

Background
I am new to the Laravel Package.
In my Laravel application I usually run the following command in order to install Bican Rokes, change the config files, etc...
php artisan make:auth
php artisan migrate
Objective
However, this process is tedious, so I was wondering if it is possible to create a package capable of automatizing the process.
What I tried
To achieve this I read the Laravel documentation, which teaches how to create packages, but I was unable to understand if this is possible and if it yes, how it should be done.
Questions
Can a package be used to automate this behaviour?
If yes, can you provide it?
If not, can you explain to me what a package really is? (links to tutorials are welcome)
If I cannot use a package, is there any other way of doing this?

I am not pushing the sale of anything, nor do I know this guy. But this tutorial is a pretty good starting point for laravel.
Laravel Tutorial Series

if a separate package should be created or not will depend on volume of work you want to accomplish. a starting point can be a custom console command, and from with-in that command, you can call multiple other commands.. And from their you can extend it to do other things like editing files etc. If you don't know how to write a console command in Laravel, here is the link to docs: https://laravel.com/docs/5.2/artisan#writing-commands

Related

How to include a Project from a server into a Laravel sail docker image

I am totally new to PHP / Laravel / Linux / composer / docker etc.
However I do have the task: go retrieve some code files from an internal server and make a docker container out of it. The project is written in PHP 7.1.3 and uses the Laravel framework.
I've copied the whole https folder from the server which I think contains everything I need.
I also was able to create the example app from the Laravel documentation and also I made a brand new Laravel project. However, is there any chance to "generate" a new project using all the code files I have right now?
I even have a composer.json and composer.lock file, which in my opinion should "list" every component I would need in my docker installation, right?
What also bugs me is that I can't even get the project working on my dev machine...
I think you should do this step by step. But let me first answer some of your questions.
If "https" folder contains similar folder structure like fresh Laravel installation, it is likely to be all of it. But we can not be sure about it.
As far as i know there is no way to generate new project out of your files. First of all you need to know which Laravel version project uses. It must be stated at composer.json.
In you composer.json file lists required packages for you project. When you install them this packages are installed folder called vendor
Here is my suggestions;
As you stated it seems you are very new about these topics if someone give these task to you its not a smart way to teach this kind of topics.
I think you have to start with running project in your local machine. If you get errors than ask them in a new question. Most likely you need database and you need to know running migrations seeds etc.
When you manage to run the project you can start dockerizing your project. If your project is build with newer versions of laravel you can easly use sail otherwise you can build own dockerfile or upgrade laravel to newer versions.
Your problem is too broad, i think you cannot find answers to such question.

Is there a way to remove algolia/scout from laravel?

im am new to laravel and I recently installed Alogila on my Laravel application as I was working on a searching functionality using Laravel scout. The command I typed was composer require algolia/scout-extended
I am getting an error saying Impossible to connect, please check your Algolia Application Id.
Since I have decided to not have a searching functionality in my application, I would like to remove algolia from my app. I am unsure of how to do this, any help would be much appreciated.
You have two way to do that
first way
run the command
composer remove algolia/scout-extended
Second way
remove it from your composer.json file
then run the command
composer update

How to update CakePHP?

I have to update CakePHP from current, outdated version (2.7.7) to latest on 2 branch, because of PHP7 support.
While I've done numerous framework upgrades before, I found book.cakephp.org a more than a cryptic about key things which I ask here:
can it be done by replacing directoris
which directories are intended to be replaced (never edit dirs, like system in Codeigniter)
which directories are partially replaced if any
is there SQL commands that should be run?
is there other commands that should be run?
Any clue is appreciated, but 2 and 3 are of most value I guess. Thanks in advance.
Depending on how you've installed CakePHP, you either use composer to update the CakePHP core dependency:
$ composer update
or require a specific constraint/version if your current constraint doesn't allow upgrading:
$ composer require cakephp/cakephp:^2.10.3
If you're not using composer (I'd suggest to switch to using it), then you download the latest release package manually, and completely replace the /lib/Cake directory. With respect to the core, the upgrade is then complete.
Then read the migration guides to figure the possible changes that you have to apply to your application code or database schemas, and also compare the "application template" changes (/app/) to your local application and apply changes in case necessary. After this, run your test suite to ensure that everything works as expected.
With that being said, the upgrade from 2.7 to the latest 2.10 should be pretty easy, as it is said to be fully API compatible.
I recommend you to use composer to manage your framework and extensions.
With composer installed, it would be much easier to update. If you decide to use composer, let me know if you need any more help by installation, setup or update.

How to Deploy a Cake PHP App

I wonder if someone can help me. I've been handed in a Cake PHP app that I need to 1) add minor changes 2) deploy. I've never really worked with Cake before and was wondering whether do I need to anything in order for it to work?
For instance, With a Node app, you need to install modules npm install. With a Rails app you'll likely need to install the gems bundle install.
Is there something similar with Cake? I've set the localhost server, but when I try to access the url I get all sort of errors. Some I've fixed (missing environment settings which I just override the Redis host and port). The latest one is:
{
"exception":{
"class":"MissingControllerException",
"code":404,
"message":"Controller class Controller could not be found.",
"file":"\/Library\/WebServer\/Documents\/php\/oompbe\/vendors\/cakephp\/lib\/Cake\/Routing\/Dispatcher.php",
"line":154,
"trace":[
"#0 \.../app\/webroot\/index.php(109): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))",
"#1 {main}"
]
}
}
PS: What's up with all the crazy \/\/?
PPS: Can I find out the version Cake I'm running?
CakePHP is just php. As most properly done php apps these days it comes with composer. I recommend you to read at least the basics of it's manual. Composer is an awesome tool.
git clone <repo>
cd <reponame>
composer install
If you start a new Cake application the official documentation tells you how to this as well:
composer create-project --prefer-dist cakephp/app [app_name]
If you want to automate things further composer provides you callback scripts. They'll allow you to automate tasks, basically trigger commands, after different actions. This is pretty useful to build assets after a composer update for example. I recommend you to not put lots of commands into that section but instead have dedicated script files you trigger by the callbacks.
Can I find out the version Cake I'm running?
If installed via composer it is usually in vendor/cakephp/cakephp/version.txt. Check the content of that file.

Why use npm with laravel?

As npm is the package manager for node, I frequently see it used with laravel boilerplate projects, but I can't reason why?
For example, this laravel-5-boilerplate instructs to npm install within the steps of installing the project..
Other examples too can be found of using npm with laravel..
Can someone please explain to me?
Nowadays npm containing general tools for work with various front-end tasks. So, it's very useful to grab some packages from it. In case of laravel, there is two utilities, that it uses:
gulp - streaming building tool for concatenating, minifing your css,js code.
laravel-elixir - is wrapper for gulp, written by Jeffrey Way, who is doing laracasts for us. It's place where you can found out more about this this tool in particular and in common.
If you will use only standart js/css, you can pass this step.
Blockquote
I made that boilerplate. That command is specific to download the
dependencies for the Laravel Elixir package
(http://laravel.com/docs/5.0/elixir) But has many, many uses outside
that.
The Elixir docs explain it very well.

Categories